Skip to content

Instantly share code, notes, and snippets.

@pl-phan
Created May 16, 2021 08:15
Show Gist options
  • Save pl-phan/c11ad0d9d76ef6336421ab5fae37efc6 to your computer and use it in GitHub Desktop.
Save pl-phan/c11ad0d9d76ef6336421ab5fae37efc6 to your computer and use it in GitHub Desktop.
Download at best quality
#!/bin/bash
if test "$1" = "video"; then
youtube-dl --merge-output-format mkv -o './%(upload_date)s_%(title)s.%(ext)s' $2
elif test "$1" = "music"; then
youtube-dl -f bestaudio -x --audio-format mp3 --audio-quality 0 -o './%(upload_date)s_%(title)s.%(ext)s' $2
elif test "$1" = "playlist-video"; then
youtube-dl --merge-output-format mkv -o './%(playlist_index)s_%(title)s.%(ext)s' $2
elif test "$1" = "playlist-music"; then
youtube-dl -f bestaudio -x --audio-format mp3 --audio-quality 0 -o './%(playlist_index)s_%(title)s.%(ext)s' $2
elif test "$1" = "formats"; then
youtube-dl --list-formats $2
elif test ${#1} -gt 25; then
youtube-dl --merge-output-format mkv -o './%(upload_date)s_%(title)s.%(ext)s' $1
else
cat ./dl.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment