-
Notifications
You must be signed in to change notification settings - Fork 1
/
youtube.py
34 lines (27 loc) · 953 Bytes
/
youtube.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
from pytube import YouTube, Playlist
import clearScreen as c
def downloadPlaylist(link):
c.clear_screen()
try:
playlist = Playlist(link)
count = 0
for video in playlist.videos:
video_title = video.title
count += 1
video_title = f'''{count}. {video_title}.mp4'''
print("Downloading... : " + video_title)
video.streams.get_highest_resolution().download(filename=video_title)
print("Download Completed!")
print("DOWNLOADED THE FULL PLAYLIST!")
except:
print("There is an error. Please Run again")
def downloadVideo(link):
c.clear_screen()
try:
video = YouTube(link)
video_title = video.title
print("Downloading... : " + video_title)
video.streams.get_highest_resolution().download()
print("Download Completed!")
except:
print("There is an error. Please Run again")