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/?a=commitdiff_plain;h=5511243778170cfb90320506e49d9f36d0817015;hp=e5f76a4a8f5f8849a2327bb8ac9de3528ed2edb6;p=dotfiles.git 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