5 exe_location="$current_dir"/bin/yt-dlp
6 ffmpeg_location=/usr/bin/ffmpeg
7 audio_dir="$current_dir"/audio
8 video_dir="$current_dir"/video
13 # Function to hold audio download command
15 "$exe_location" -x -f 'ba' --audio-format mp3 -o "$audio_dir/%(title)s.%(ext)s" "$url"
18 # Function to hold video download command
20 "$exe_location" -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' -o "$video_dir/%(title)s.%(ext)s" "$url"
23 # Check if ffmpeg is installed
24 if [ ! "$ffmpeg_location" ]; then
25 echo "Missing dependency ffmpeg"
30 if [ "$exe_location" ]; then
34 # Download new executable
35 wget -q -O "$exe_location" https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
37 # Make executable executable
38 chmod +x "$exe_location"
40 # Check if audio directory exists, if not, create it
41 if [ ! "$audio_dir" ]; then
45 # Check if video directory exists, if not, create it
46 if [ ! "$video_dir" ]; then
50 # While loop to contain download logic
51 while [ "$val" -ne 1 ]; do
52 # Ask user if they want to download audio or video
53 read -p "Audio or Video?: " type
56 if [ "$type" = "audio" ]; then
57 read -p "Enter URL Here: " url
61 elif [ "$type" = "video" ]; then
62 read -p "Enter URL Here: " url
65 # If invlaid response is given, start over
67 echo "Must be 'Audio' or 'Video'!"
72 # If you made it here you get a sweet exit code 0