from pytube import Playlist import youtube_dl, os, time from moviepy.editor import * ### FOR DOWNLOAD 1 VIDEO ### ## FUNTIONS ## # downloading def download(): try: print("downloading...", link) with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([link]) except: print("un probleme est survenu... on réessaye!") # converting and renaming fonction def convert(video): videoO = VideoFileClip(video) # split the .mp4 filename, file_extension = os.path.splitext(str(video)) # renvoie le .mp3 dans le repertoire de destination return videoO.audio.write_audiofile(os.path.join("./" + destination + "/" + filename + ".mp3")) ## MAIN PROGRAM # recup des liens de la playlist via lien playlist input link = str(input("Entrer le lien de la video youtube a télécharger: ")) # creation du repertoire destination #destination = str(input("Entrer le repertoire de destination:")) destination = "" #os.mkdir("./" + destination + "") # options ydl_opts = {'format': 'best',} # download download() # fini! print("Téléchargement terminé!")