forked from gigacrab/Pytube_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PytubeProject.py
23 lines (23 loc) · 876 Bytes
/
PytubeProject.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pytube import YouTube
while True:
#For user to insert video's url
input_url = (input('Insert url: '))
#Displaying an error if the provided url isn't valid
try:
youtube = YouTube(input_url)
print(f'Downloading link: {input_url}')
print(f'Downloading video: {youtube.title}')
except:
print('An error has occurred, please try again.\n')
continue
#To download video, followed up by the destination of the download
youtube.streams.first().download("")
print('Download success!')
#Asking the user whether they would like to continue or not
quit_continue = (input('Would you like to continue? (Y)es/(N)o \n> ')).lower()
if quit_continue == 'n':
print('Thank you for using our programme, have a nice day!')
break
elif quit_continue == 'y':
print('')
continue