-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoutube_downloader_720p.py
64 lines (44 loc) · 1.58 KB
/
youtube_downloader_720p.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
from pytube import YouTube
from sys import argv
import os
from pathlib import Path
'''
📺 Youtube Video Downloader 720p
usage in Comand Prompt: python3 youtube_video_downloader_720p.py [link]
It is a video downloader for YouTube created using pytube and some other libraries for downloading 720p videos in mp4 format.
> Insert link in place of [link] in comand prompt.
> It can be used to download YouTube videos of only 720p size.
> pytube is only dependency required.
> To install pytube -> pip install pytube
> To Batch install videos insert all links in links list
'''
# For Batch download insert all links in string type in list below.
links = []
# Checking if link is provided
try:
link = argv[1]
except IndexError:
link = None
# To change download location fell free to change below
path_to_download_folder = str(os.path.join(Path.home(), "Downloads"))
# YouTube video download Function
def Youtube_Downloader(Link):
# Checking if link exists
if link is None:
print("😞 No link was provided so no video downloaded.")
return
# youtube object
yt = YouTube(link)
print("Title = ", yt.title)
print("Downloading... ⏳⌛⏳⌛")
# Selects the 720p version for video
yd = yt.streams.get_highest_resolution()
# Downloads the video
yd.download(path_to_download_folder)
print("🙂 Completed download. Enjoy. 😎")
# Calling the Youtube_Downloader function
Youtube_Downloader(link)
# Batch downloading videos
if links != []:
for link in links:
Youtube_Downloader(link)