From 6eecf3f5176e334b23ede96ed8689bee6a0e1e0d Mon Sep 17 00:00:00 2001 From: overcrash <3681221+overcrash66@users.noreply.github.com> Date: Wed, 18 Oct 2023 23:19:52 -0300 Subject: [PATCH] Update AudioFileTranslator-S2ST.py Youtube Downloader should download only mp4 video files --- AudioFileTranslator-S2ST.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/AudioFileTranslator-S2ST.py b/AudioFileTranslator-S2ST.py index ff933cc..4f6bfca 100644 --- a/AudioFileTranslator-S2ST.py +++ b/AudioFileTranslator-S2ST.py @@ -50,7 +50,7 @@ def YouTubeDownloader(): new_window.attributes('-fullscreen', False) def download(): url = url_entry.get() - format_selected = selected_format.get() + format_selected = "mp4" if not url: messagebox.showerror("Error", "Please enter a valid YouTube URL.") @@ -60,12 +60,8 @@ def download(): yt = YouTube(url) video_title = yt.title - if format_selected == "mp3": - output_path = f"{video_title}.mp3" - subprocess.run(["ffmpeg", "-i", yt.streams.filter(only_audio=True).first().download(), "-vn", "-acodec", "libmp3lame", output_path]) - elif format_selected == "mp4": - output_path = f"{video_title}.mp4" - subprocess.run(["ffmpeg", "-i", yt.streams.filter(file_extension='mp4').first().download(), output_path]) + output_path = f"{video_title}.mp4" + subprocess.run(["ffmpeg", "-i", yt.streams.filter(file_extension='mp4').first().download(), output_path]) messagebox.showinfo("Success", f"Download complete!\nFile saved as {output_path}") @@ -78,16 +74,6 @@ def download(): url_entry = Entry(new_window, width=40) url_entry.grid(row=0, column=1, padx=10, pady=10) - format_label = Label(new_window, text="Output Format:") - format_label.grid(row=1, column=0, padx=10, pady=10) - - formats = ["mp3", "mp4"] - selected_format = StringVar(new_window) - selected_format.set(formats[0]) # default format - - format_menu = OptionMenu(new_window, selected_format, *formats) - format_menu.grid(row=1, column=1, padx=10, pady=10) - download_button = Button(new_window, text="Download", command=download) download_button.grid(row=2, column=0, columnspan=2, pady=10) new_window.mainloop()