Skip to content

Commit 76e18b7

Browse files
authored
Add files via upload
1 parent 49e1272 commit 76e18b7

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Day3(downloader).py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from pytube import YouTube
2+
from pytube import Playlist
3+
4+
print("-------Downloader for Videos or Playlist form YouTube------")
5+
6+
7+
pref=int(input("""What do you wanna to download \n 1)Audio 2)Video 3)Playlist \n (Plaease , enter the number)\n""") )
8+
9+
if pref==1:
10+
link=input("Please , enter the URL :")
11+
youtube_1=YouTube(link)
12+
print(youtube_1.title)
13+
videos=youtube_1.streams.filter(only_audio=True)
14+
vid=list(enumerate(videos))
15+
for i in vid:
16+
print(i)
17+
print()
18+
strm=int(input("Please , enter your preference :"))
19+
videos[strm].download()
20+
print("Successfully download !")
21+
elif pref==2:
22+
link=input("Please , enter the URL :")
23+
youtube_1=YouTube(link)
24+
print(youtube_1.title)
25+
videos=youtube_1.streams.filter(only_video=True)
26+
vid=list(enumerate(videos))
27+
for i in vid:
28+
print(i)
29+
print()
30+
strm=int(input("Please , enter your preference :"))
31+
videos[strm].download()
32+
print("Successfully download !")
33+
34+
elif pref==3:
35+
link=input("Please , enter the URL :")
36+
py = Playlist(link)
37+
print(f'Downloading : {py.title}')
38+
for video in py.videos:
39+
video.streams.first().download()
40+
41+
42+
43+
44+

0 commit comments

Comments
 (0)