Skip to content

Commit cd8d01e

Browse files
authored
Added YouTube Downloader application to this repo
I wrote a new approach YouTube downloader python application I hope it's useful for this repo and gets merge I learned a lot from this repo and I just wanted to make a contribution
1 parent 2717a2c commit cd8d01e

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
from pytube import YouTube
2+
from tkinter import *
3+
from pytube.cli import on_progress
4+
#Asking for all the video links
5+
n = int(input("Enter the number of youtube videos you want to download:"))
6+
# A list to store all the links
7+
links = []
8+
# Asking for the links one per line
9+
print("\nEnter every one of the links in individual line:")
10+
for i in range(0, n):
11+
temp = input()
12+
links.append(temp)
13+
#Showing all details for videos and downloading them one by one
14+
for i in range(0, n):
15+
link = links[i]
16+
yt = YouTube(link,on_progress_callback=on_progress)
17+
print(yt)
18+
print("\nDetails for Video", i+1, "\n")
19+
print("Video's Title: ", yt.title)
20+
print("Number of views: ", yt.views)
21+
print("video's Length: ", yt.length, "seconds")
22+
23+
# Filter to select only progressive streams
24+
stream = str(yt.streams.filter(progressive=True))
25+
stream = stream[1:]
26+
stream = stream[:-1]
27+
streamlist = stream.split(", ")
28+
print("\nAll available options for downloads:\n")
29+
30+
# loop around all available streams and print them for user to decide
31+
for i in range(0, len(streamlist)):
32+
st = streamlist[i].split(" ")
33+
print(i+1, ") ", st[1], " and ", st[3], sep='')
34+
35+
36+
# ask user the tag forthe stream to download
37+
38+
'''
39+
272: webm video 2880p/4320p
40+
94: mp4 video 144p
41+
395: mp4 video 240p
42+
396: mp4 video 360p
43+
397: mp4 video 480p
44+
398: mp4 video 720p
45+
399: mp4 video 1080p
46+
400: mp4 video 1440p
47+
401: mp4 video 2160p
48+
402: mp4 video 2880p
49+
298: mp4 video 720p60
50+
299: mp4 video 1080p60
51+
'''
52+
53+
tag = int(input("\nEnter the itag of your preferred stream to download: "))
54+
ys = yt.streams.get_by_itag(tag)
55+
print("\nDownloading...")
56+
57+
58+
59+
ys.download()
60+
print("\nDownload completed :)")
61+
print()
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+

0 commit comments

Comments
 (0)