From 5511243778170cfb90320506e49d9f36d0817015 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 27 Jan 2023 16:40:12 +0300 Subject: [PATCH] Automatically prepend youtube URL --- youtube-dl/bin/yt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.44.0