From b0b8ab40f59bf20f7f03148222db1e416d9743e5 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Sat, 13 Aug 2022 15:00:18 -0500 Subject: [PATCH] Automatically determine download format... --- ytdl.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ytdl.sh b/ytdl.sh index 718dd37..c4e9f70 100644 --- a/ytdl.sh +++ b/ytdl.sh @@ -1,5 +1,8 @@ #!/bin/bash set -x -/usr/local/bin/youtube-dl --newline -f 18 "${1}" 2>&1 | /usr/bin/stdbuf -i0 -o0 -e0 cut -c 11-14 | while read x +# get format - I take the first one in the list that does not have audio or video only... +frm=$(youtube-dl -F 'https://www.youtube.com/watch?v=SLWJuKQD030' | grep -v only | head -n4 | tail -n1 | awk -e '{print $1}') + +/usr/local/bin/youtube-dl --newline -f $frm "${1}" 2>&1 | /usr/bin/stdbuf -i0 -o0 -e0 cut -c 11-14 | while read x do /usr/bin/stdbuf -i0 -o0 -e0 printf "%3d%% .................................................................................................... \r\n" ${x} done