Nouvelles Du Monde

python 3.x – Comment corriger l’erreur d’un téléchargeur Youtube StringVar ?

python 3.x – Comment corriger l’erreur d’un téléchargeur Youtube StringVar ?

2024-01-23 11:22:47

J’essaie de créer une application graphique du téléchargeur YouTube en utilisant tkinter.mais exécutez le code Erreur :

Exception dans le rappel de Tkinter Traceback (dernier appel le plus récent) : Fichier “C:\Users\Amir Mahmoudi\AppData\Local\Programs\Python\Python312\Lib\tkinter_*init* _.py”, ligne 1962, dans **call** return self.func(*args) ^^^^^^^^^^^^^^^^ Fichier “C:\Users\Amir Mahmoudi PycharmProjects\pythonProject1\Youtub Downloader.py”, ligne 41, en téléchargement yt = YouTube(lien) ^^^^^^^^^^^^^ Fichier “C:\Users\Amir Mahmoudi\ PycharmProjects\pythonProject1.venv\Lib\site-packages\pytube_main*_.py”, ligne 71, dans **init** self.video_id = extract.video_id(url) ^^^^^^^ ^^^^^^^^^^^^^ Fichier “C:\Users\Amir Mahmoudi\PycharmProjects\pythonProject1.venv\Lib\site-packages\pytube\extract.py” , ligne 133, dans video_id return regex_search(r”(?:v=|/)([0-9A-Za-z_-]{11}).”, url, groupe=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ Fichier “C:\Users\Amir Mahmoudi\PycharmProjects\pythonProject1.venv\Lib\site- packages\pytube\helpers.py”, ligne 129, dans regex_search raise RegexMatchError(caller=”regex_search”, pattern=pattern) pytube.exceptions.RegexMatchError: regex_search: could not find match for (?:v=|/) ([0-9A-Za-z_-]{11}).* importer tkinter en tant que tk depuis tkinter importer la boîte de message depuis tkinter.filedialog importer le répertoire request depuis pytube importer YouTube depuis la tortue importer la largeur window = tk.Tk() window.title(“Youtube Downloader”) window.minsize(450 , 200) def widgets() : link_label = tk.Label(window, text=”Lien vidéo”) link_label.grid(row=0, column=0, padx=20, pady=20) link_label.config(font=( “Aucun”, 15), premier plan=”bleu”) link_entry = tk.Entry(window, width=40) link_entry.grid(row=0, column=1, padx=20, pady=20) place_label = tk.Label (window, text=”Répertoire”) place_label.grid(row=1, column=0, padx=20, pady=20) place_label.config(font=(“None”, 15), foreground=”blue”) place_entry = tk.Entry(window, width=30, textvariable=download_dir) place_entry.grid(row=1, column=1, padx=20, pady=20, sticky=”w”) place_button = tk.Button(window, texte =”open”, width=8, background=”blue”, foreground=”white”, command=brows) place_button.grid(row=1, column=2) download_button = tk.Button(window, text=”Télécharger maintenant “, pady=10, command=download) download_button.grid(row=2, column=1) download_button.config(height=3, width=20, background=”green”, foreground=”white”) def brows() : directory = requestdirectory(initialdir=”VOTRE CHEMIN DE RÉPERTOIRE”, title=”save”) download_dir.set(directory) def download(): link = video_link.get() print(link) save_dir = download_dir.get() yt = YouTube(lien) yt.streams.first().download(save_dir) messagebox.showinfo(“Succès”, message=”Votre vidéo téléchargée avec succès”) download_dir = tk.StringVar() video_link = tk.StringVar() widgets() fenêtre.mainloop()


#python #3.x #Comment #corriger #lerreur #dun #téléchargeur #Youtube #StringVar
1706009163

Facebook
Twitter
LinkedIn
Pinterest

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

ADVERTISEMENT