From: Sergey Matveev Date: Fri, 27 Jan 2023 13:40:12 +0000 (+0300) Subject: Automatically prepend youtube URL X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=commitdiff_plain;h=5511243778170cfb90320506e49d9f36d0817015 Automatically prepend youtube URL --- diff --git a/youtube-dl/bin/yt b/youtube-dl/bin/yt index 01a2af0..174f043 100755 --- a/youtube-dl/bin/yt +++ b/youtube-dl/bin/yt @@ -1,4 +1,7 @@ #!/usr/local/bin/zsh . ~/work/youtube-venv/bin/activate -yt-dlp --config-location ~/.youtube-dl.conf $@ +url=${@[${#@}]} +args=(${@[1,${#@}-1]}) +[[ ${#url} -eq 11 ]] && url=https://www.youtube.com/watch?v=$url +yt-dlp --config-location ~/.youtube-dl.conf ${=args} $url