import subprocess def download_playlist(playlist_url): try: # Construit la commande youtube-dl avec le drapeau --verbose command = ["youtube-dl", "--verbose", "--yes-playlist", playlist_url] # Exécute la commande et capture la sortie process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) output, error = process.communicate() if process.returncode == 0: print("Téléchargement de la playlist réussi !") else: print("Erreur lors du téléchargement de la playlist :") print(error) print("Sortie complète de youtube-dl :") print(output) except Exception as e: print("Une erreur est survenue :", e) # Utilisation playlist_url ='https://www.youtube.com/watch?v=CV2oX-3ezU0' download_playlist(playlist_url)