Skip to content

Commit 670dc6b

Browse files
Merge pull request #1650 from TheKidPadra/master
Added YouTube Downloader application to this repo
2 parents 08f346f + 8cc87da commit 670dc6b

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

Padra's YouTube Downloader/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# About this YouTube Downloader
2+
3+
this YouTube Downloader has been written by pytube and tkinter library.
4+
5+
first it takes the number of youtube videos you want to download.
6+
then it asks you to Enter every one of the links in individual line to store it to a list.
7+
In third part, it starts Showing you all the details like (Video's Title, Number of views, video's Length) for videos and starts downloading them one by one
8+
It also shows you all the availabe itags for you to choose what quality you want to download your videos.
9+
10+
## Instructions
11+
12+
1. install pytube library
13+
To install pytube, run the following command in your terminal:
14+
```
15+
$ pip install pytube
16+
```
17+
## Get the Source Code
18+
19+
pytube is actively developed on GitHub, where the source is available.
20+
21+
You can either clone the public repository:
22+
```
23+
$ git clone git://github.com/pytube/pytube.git
24+
```
25+
Or, download the tarball:
26+
27+
```
28+
$ curl -OL https://github.com/pytube/pytube/tarball/master
29+
# optionally, zipball is also available (for Windows users).
30+
```
31+
Once you have a copy of the source, you can embed it in your Python package, or install it into your site-packages by running:
32+
```
33+
$ cd pytube
34+
$ python -m pip install .
35+
```
36+
37+
2. install tkinter library
38+
Tkinter can be installed using pip. The following command is run in the command prompt to install Tkinter.
39+
```
40+
$ pip install tk
41+
```
42+
43+
3. then you can run the program and see the result
44+
```
45+
$ pyhon3 YouTube_Donlowder.py
46+
```
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)