As an AI language model, I don't have access to your specific script. However, here's how you can create a GUI script using Python's built-in tkinter library:
In this script, we create a GUI window using tk.Tk(), set the window title using the title() method, and add an input box, button, and output label using tk.Entry(), tk.Button(), and , respectively. We then define the function to retrieve the text entered into the input box and update the output label with a greeting message. Finally, we start the main event loop using .
User
Assistant
User
File "/var/home/user/yt.py", line 9
url = subprocess.check_output(“xclip -o”, shell=True)
^
SyntaxError: invalid character '“' (U+201C
Assistant
The issue is likely caused by the quotes you're using around "xclip -o". It appears that the quotes are formatted as "smart quotes" or "curly quotes", which Python doesn't recognize. You should replace these quotes with standard double quotes:
This code creates a GUI window with an input for the video URL, radio buttons for choosing the download format, an input for selecting a playlist range (if applicable), and a button to initiate the download. The run_command() function takes the URL from the input, parses the chosen format and playlist range (if applicable) from the radio buttons and inputs, and runs the appropriate yt-dlp command.
#!/bin/bash
# get URL and chosen format from user
URL=$(zenity --entry --title="YouTube Downloader" --text="Enter a YouTube video URL:")
FORMAT=$(zenity --forms --title="Choose a download format" --text="Choose a format to download:" \
--add-combo="Format:" --combo-values="480p+sub|480p+sub+Playlist|480p+sub+Aria2|720p+sub|720p+sub+Playlist|720p+sub+Aria2|See Format - single video|Playlist + Custom Format|For only SUBs (en,tr-en)|From Batch File (720p)" \
--add-entry="Playlist range:")
# extract format and playlist range from user input
FMT=$(echo "$FORMAT" | cut -d '|' -f 1)
PLAY_RANGE=$(echo "$FORMAT" | cut -d '|' -f 2)
# create corresponding ytdlp arguments for chosen format
case "$FMT" in
"480p+sub")
YTDLP_ARGS="-f 244+250/bv[height<=480]+ba/best[height<=480] --write-subs --write-auto-sub --convert-subs srt --embed-subs --sub-lang en-tr,en --embed-thumbnail --compat-options no-keep-subs --merge-output-format=mkv"
;;
"480p+sub+Playlist")
YTDLP_ARGS="--playlist-items $PLAY_RANGE -f 244+250/bv[height<=480]+ba/best[height<=480] --download-archive Desktop/Downloads/Youtube/archive.txt --write-subs --write-auto-sub --convert-subs srt --embed-subs --sub-lang en-tr,en --embed-thumbnail --compat-options no-keep-subs --merge-output-format=mkv"
;;
"480p+sub+Aria2")
YTDLP_ARGS="-f 244+250/bv[height<=480]+ba/best[height<=480] --downloader aria2c --downloader-args='--continue=true --max-connection-per-server=4 --max-tries=5 --retry-wait=3 --timeout=5' --write-subs --write-auto-sub --convert-subs srt --embed-subs --sub-lang en-tr,en --embed-thumbnail --compat-options no-keep-subs --merge-output-format=mkv"
;;
"720p+sub")
YTDLP_ARGS="-f 247+251/22/best[height<=720] --write-subs --write-auto-sub --convert-subs srt --embed-subs --sub-lang en-tr,en --embed-thumbnail --compat-options no-