-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYouTube_Video_Downloader.py
31 lines (25 loc) · 1.16 KB
/
YouTube_Video_Downloader.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
from pafy import new
#if you don't have this lib you should install it from pip
#run <pip install pafy > then < pip install youtube.dl >
vid_url=input('Enter your YouTube video URL : ') #get url
DV = new(vid_url)
print ('\n',DV.title) #print video titel
VidQuality=DV.streams #get avilable video qualites
SoundQuality=DV.audiostreams #get avilable sound qualites
print('=================================================')
print('\nThe Avilable Video Qualites is : \n')
for i in range(len(VidQuality)):
print(i+1,'- ',VidQuality[i]) #printing differnt avilable video qualites
print('\n\nThe Avilable Sounds Qualites is : \n')
for i in range(len(SoundQuality)):
print(i+1,'- ',SoundQuality[i]) #printing differnt avilable audio qualites
print('\n================================================')
print('To Download Video press 1 , to download audio press 2 : ')
flag=int(input())
dwon=int (input ('\nChose quality to download : '))
if flag==1 :
VidQuality[dwon-1].download() #start downloading the video in the same path of script
elif flag==2:
SoundQuality[dwon-1].download() #start downloading the audio in the same path of script
else :
print('Error')