Skip to content

Instantly share code, notes, and snippets.

@cosmicqbit
Created June 25, 2023 14:03
Show Gist options
  • Save cosmicqbit/500840529666d7be853ae62d8dd8d377 to your computer and use it in GitHub Desktop.
Save cosmicqbit/500840529666d7be853ae62d8dd8d377 to your computer and use it in GitHub Desktop.
Youtube Downloader
#!/bin/bash
opt1="YTDL-Best Quality"
opt2="YTDL-Maximum 720p"
opt3="YTDLP-Best Quality"
opt4="YTDLP-Maximum 720p"
opt5="Export YT Comments"
opt6="Export YT Subtitles"
opt7="Export YT Info"
timestamp=$(date +%Y-%m-%d_%H_%M)
videodownloadmenu=$(zenity --list --title "Video Downloader" --radiolist --column "" --column "" TRUE "$opt1" FALSE "$opt2" FALSE "$opt3" FALSE "$opt4" FALSE "$opt5" FALSE "$opt6" FALSE "$opt7" --height=400 --width=300)
case $videodownloadmenu in
$opt1 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Best Quality" --text "Enter Target URL")
youtube-dl "$url" -o ~/Documents/Videos/YTDL/"$timestamp-%(title)s.%(ext)s" -i --all-subs
open ~/Documents/Videos/YTDL/
exit;;
$opt2 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Maximum 720p" --text "Enter Target URL")
youtube-dl "$url" -o ~/Documents/Videos/YTDL/"$timestamp-%(title)s.%(ext)s" -i -f 'bestvideo[height<=720]+bestaudio' --all-subs
open ~/Documents/Videos/YTDL/
exit;;
$opt3 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Best Quality" --text "Enter Target URL")
yt-dlp $url -o ~/Documents/Videos/YTDL/"$timestamp-%(title)s.%(ext)s" -i --all-subs
open ~/Documents/Videos/YTDL/
exit;;
$opt4 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Maximum 720p" --text "Enter Target URL")
yt-dlp "$url" -o ~/Documents/Videos/YTDL/"$timestamp-%(title)s.%(ext)s" -i -f 'bestvideo[height<=720]+bestaudio' --all-subs
open ~/Documents/Videos/YTDL/
exit;;
$opt5 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Export YT Comments" --text "Enter Target URL")
cd ~/Documents/Videos/YTDL/
yt-dlp "$url" -o ~/Documents/Videos/Youtube-DL/$timestamp-comments --write-comments --skip-download
open ~/Documents/Videos/YTDL/
exit;;
$opt6 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
cd ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Export YT Subtitles" --text "Enter Target URL")
youtube-dl --all-subs --skip-download --write-auto-sub "$url"
open ~/Documents/Videos/YTDL/
exit;;
$opt7 )
mkdir ~/Documents/Videos/
mkdir ~/Documents/Videos/YTDL/
url=$(zenity --entry --title "Export YT Info" --text "Enter Target URL")
cd ~/Documents/Videos/YTDL/
yt-dlp "$url" -o ~/Documents/Videos/YTDL/$timestamp-info --write-comments --skip-download
open ~/Documents/Videos/YTDL/
exit;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment