-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathpytube.py
121 lines (110 loc) · 3.83 KB
/
pytube.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python
#
from __future__ import unicode_literals
import youtube_dl
import os
import sys
os.system("clear && clear && clear")
logo = '''
8888888b. 88888888888 888
888 Y88b 888 888
888 888 888 888
888 d88P 888 888 888 888 888 88888b. .d88b.
8888888P" 888 888 888 888 888 888 "88b d8P Y8b
888 888 888 888 888 888 888 888 88888888
888 Y88b 888 888 Y88b 888 888 d88P Y8b.
888 "Y88888 888 "Y88888 88888P" "Y8888
888
Y8b d88P
"Y88P"
\033[0m \033[91m \033[1m }--{+} Coded By Manisso {+}--{
\033[0m \033[91m \033[1m }----{+} fb.me/dzmanisso {+}----{
\033[0m \033[91m \033[1m }--{+} Greetz To IcoDz {+}--{
'''
menu = '''\033[0m
{1}--Video Download
{2}--Audio Download
{3}--Audio PlayList Download
{99}-Exit
'''
print logo
print menu
def quit():
con = raw_input('Continue [Y/n] -> ')
if con[0].upper() == 'N':
exit()
else:
os.system("clear")
print logo
print menu
select()
def select():
try:
choice = input("SnapTub~# ")
if choice == 1:
os.system("clear")
print """
__ __ __ __
/ | / |/ | / |
$$ | $$ |$$/ ____$$ | ______ ______
$$ | $$ |/ | / $$ | / \ / \
$$ \ /$$/ $$ |/$$$$$$$ |/$$$$$$ |/$$$$$$ |
$$ /$$/ $$ |$$ | $$ |$$ $$ |$$ | $$ |
$$ $$/ $$ |$$ \__$$ |$$$$$$$$/ $$ \__$$ |
$$$/ $$ |$$ $$ |$$ |$$ $$/
$/ $$/ $$$$$$$/ $$$$$$$/ $$$$$$/
PUT URL EX: https://www.youtube.com/watch?v=PYJHFVBsmeQ
"""
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([raw_input('URL: ')])
print("")
quit()
elif choice == 2:
os.system("clear")
print """
/$$$$$$ /$$ /$$
/$$__ $$ | $$|__/
| $$ \ $$ /$$ /$$ /$$$$$$$ /$$ /$$$$$$
| $$$$$$$$| $$ | $$ /$$__ $$| $$ /$$__ $$
| $$__ $$| $$ | $$| $$ | $$| $$| $$ \ $$
| $$ | $$| $$ | $$| $$ | $$| $$| $$ | $$
| $$ | $$| $$$$$$/| $$$$$$$| $$| $$$$$$/
|__/ |__/ \______/ \_______/|__/ \______/
PUT URL EX: https://www.youtube.com/watch?v=PYJHFVBsmeQ
"""
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([raw_input('URL: ')])
quit()
elif choice == 3:
os.system("clear")
print("""
/$$$$$$$ /$$ /$$ /$$ /$$
| $$__ $$| $$ | $$|__/ | $$
| $$ \ $$| $$ /$$$$$$ /$$ /$$| $$ /$$ /$$$$$$$ /$$$$$$
| $$$$$$$/| $$ |____ $$| $$ | $$| $$| $$ /$$_____/|_ $$_/
| $$____/ | $$ /$$$$$$$| $$ | $$| $$| $$| $$$$$$ | $$
| $$ | $$ /$$__ $$| $$ | $$| $$| $$ \____ $$ | $$ /$$
| $$ | $$| $$$$$$$| $$$$$$$| $$| $$ /$$$$$$$/ | $$$$/
|__/ |__/ \_______/ \____ $$|__/|__/|_______/ \___/
/$$ | $$
| $$$$$$/
\______/
EX: https://www.youtube.com/watch?v=lp-EO5I60KA&list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj
""")
d3 = raw_input('playlist URL: ')
os.system("clear")
os.system("youtube-dl -cit --extract-audio --audio-format mp3 " + d3)
print("")
quit()
except(KeyboardInterrupt):
print ""
select()