Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelOliveiraTinoco authored Feb 10, 2024
1 parent e10a86e commit 193686c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Binary file added YouTube.ico
Binary file not shown.
27 changes: 27 additions & 0 deletions youtube-download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import tkinter as tk
from tkinter import filedialog
import os
import subprocess

# Create the Tkinter root window (it won't be shown)
root = tk.Tk()
root.withdraw() # hides the root window because we're only interested in the file dialog.

while True:
print("YouTube downloader");
link = input("YouTube link: ")
downloadFormat = input("Formato (audio/video): ").lower()
if downloadFormat != "audio" and downloadFormat != "video":
print("Formato Invalido")
continue

downloadFolder = filedialog.askdirectory(title="Selecione a pasta de download")

# check if download folder exists
if os.path.exists(downloadFolder) and os.path.isdir(downloadFolder):
# if downloadformat == video command = x else command = y
if downloadFormat == "video": subprocess.run("yt-dlp " + link + " --format bv*+ba/b --paths \"" + downloadFolder + "\"")
if downloadFormat == "audio": subprocess.run("yt-dlp " + link + " --format ba --extract-audio --audio-format mp3 --audio-quality 0 --embed-metadata --embed-thumbnail --no-keep-video --paths \"" + downloadFolder + "\"")
else:
print("Pasta Invalida")
continue

0 comments on commit 193686c

Please sign in to comment.