-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
57 lines (47 loc) · 1.78 KB
/
main.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
import platform
import ffmpeg # Autre script.
import pytubefix
import downloads # Autre script.
import os
system = platform.system()
ffmpeg.checkInstallation(system)
while True:
videoUrl = input('Lien de la vidéo YouTube : ')
youtubeVideo = pytubefix.YouTube(videoUrl)
print('Recherche des informations sur la vidéo..')
videoTitle = youtubeVideo.title
videoThumbnail = youtubeVideo.thumbnail_url
videoAuthor = youtubeVideo.author
channelUrl = youtubeVideo.channel_url
videoRestriction = 'Non'
videoViews = youtubeVideo.views
if youtubeVideo.age_restricted == True:
videoRestriction = 'Oui'
print('\nInformations sur la vidéo :')
print(f'- Titre : "{videoTitle}"')
print(f'- Miniature : {videoThumbnail}')
print(f'- Auteur : {videoAuthor} ({channelUrl})')
print(f'- Restriction adulte : {videoRestriction}')
print(f'- Nombre de vues : {videoViews} vue(s)')
print('\nQue souhaitez-vous télécharger ?')
print('1) La vidéo')
print('2) L\'audio uniquement')
print('3) La miniature')
download = input('\nNuméro de l\'option voulue : ')
while True:
if download == '1':
downloads.videoDownload(youtubeVideo, system);
break
elif download == '2':
downloads.audioDownload(youtubeVideo)
break
elif download == '3':
downloads.thumbnailDownload(videoThumbnail, videoTitle)
break
else:
print(f'L\'option entrée ("{download}") n\'est pas valide.', end = '\n\n')
download = input('Numéro de l\'option voulue : ')
restart = input('Souhaitez-vous faire un autre téléchargement ? (o/n) ')
if restart.lower() == 'n':
break
os.system('cls' if system == 'Windows' else 'clear')