adding yt downloader script
This commit is contained in:
parent
a33e0d79ab
commit
a01fe7d069
2 changed files with 54 additions and 0 deletions
2
.bashrc
2
.bashrc
|
|
@ -86,3 +86,5 @@ fi
|
|||
|
||||
export TERM="xterm-kitty"
|
||||
export PICO_SDK_PATH=/usr/share/pico-sdk
|
||||
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
|
|
|
|||
52
bin/yt
Executable file
52
bin/yt
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ] || [ $1 == "-h" ]; then
|
||||
echo -e "Usage: yt <url>\n\nurl can be any link to a video, playlist, or account on most video sites like youtube, odysee, rumble, etc."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
url="$1"
|
||||
|
||||
echo -e "What Quality?\n[1] Best\n[2] Medium\n[3] Low (default)\n[4] Audio\n"
|
||||
echo -n "Enter Your Selection: "
|
||||
read quality
|
||||
quality=${quality:-3}
|
||||
|
||||
if [ "$quality" == "1" ]; then
|
||||
quality_flag="-f bv+ba/b"
|
||||
elif [ "$quality" == "2" ]; then
|
||||
quality_flag="-f bv[height<=720]+ba/b[height<=720]"
|
||||
elif [ "$quality" == "3" ]; then
|
||||
quality_flag="-f bv[height<=480]+ba/b[height<=480]"
|
||||
elif [ "$quality" == "4" ]; then
|
||||
quality_flag="-x --audio-format mp3"
|
||||
else
|
||||
echo "Your quality selection is bad"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -ne "\nDo you want an archive? [Y/n] "
|
||||
read archive
|
||||
archive=$(tr '[:upper:]' '[:lower:]' <<< "$archive")
|
||||
|
||||
if [ "$archive" == "y" ]; then
|
||||
archive_flag="--download-archive archive.txt --no-overwrites --add-metadata"
|
||||
echo -ne "\nDo you want to create a directory for this? [Y/n] "
|
||||
read directory
|
||||
directory=${directory:-y}
|
||||
else
|
||||
archive_flag=""
|
||||
directory="n"
|
||||
fi
|
||||
|
||||
directory=$(tr '[:upper:]' '[:lower:]' <<< "$directory")
|
||||
|
||||
if [ "$directory" == "y" ]; then
|
||||
echo -ne "\nDirectory name: "
|
||||
read directory_name
|
||||
directory_name=${directory_name:-y}
|
||||
mkdir -p "$directory_name"
|
||||
cd "$directory_name"
|
||||
fi
|
||||
|
||||
yt-dlp ${quality_flag} ${archive_flag} ${url}
|
||||
Loading…
Reference in a new issue