Last active
September 15, 2023 07:57
-
-
Save amb/96a0b887c9e1ac6660d0a247b1680711 to your computer and use it in GitHub Desktop.
Simple Youtube-dl GUI with Python. Edit YDL and FOLDER to match your params
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
from tkinter import ttk | |
from subprocess import run | |
win = tk.Tk() | |
win.geometry("600x140") | |
# YDL = "youtube-dl.exe" | |
YDL = "yt-dlp.exe" | |
FOLDER = "D:\\swap\\downloads\\ydl" | |
def get_input(): | |
text_input = "" + text.get(1.0, "end-1c") | |
print("Running: " + text_input) | |
output = FOLDER + "\\" + "%(title)s.%(ext)s" | |
print(output) | |
for url in text_input.split("\n"): | |
print("URL: " + url) | |
if url == "": | |
continue | |
command = [YDL, "-o", output] | |
if audiocheck.instate(["selected"]): | |
command.extend(["-f", "bestaudio", "--extract-audio", "--audio-format", "mp3"]) | |
if not certcheck.instate(["selected"]): | |
command.extend(["--no-check-certificate", url]) | |
print(command) | |
run(command) | |
text.delete("1.0", tk.END) | |
text = tk.Text(win, width=60, height=2) | |
text.insert(tk.END, "") | |
text.pack(expand=True, fill=tk.Y) | |
b = ttk.Button(win, text="Execute", command=get_input) | |
b.pack(side=tk.RIGHT) | |
audiovalue = tk.IntVar(value=0) | |
audiocheck = ttk.Checkbutton(win, text="Audio only", variable=audiovalue) | |
audiocheck.pack(side=tk.RIGHT) | |
certvalue = tk.IntVar(value=0) | |
certcheck = ttk.Checkbutton(win, text="Check cert", variable=certvalue) | |
certcheck.pack(side=tk.RIGHT) | |
win.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment