video-json-download.sh (554B)
1 #!/usr/bin/env bash 2 die() { 3 echo "$1" >&2 4 exit 1 5 } 6 7 [ $# -ge 1 ] || die "Argument required" 8 nvideos=$(cat "$1" | jq length) 9 10 for i in `seq 0 $nvideos`; do 11 name="$(cat "$1" | jq "keys[$i]")" 12 url="$(cat "$1" | jq ."$name")" 13 echo "$name: $url" 14 15 youtube-dlc -o "$(echo $name | tr -d '"' | sed 's/.mp4//').mp4" "$(echo $url | tr -d '"')" &>/dev/null & 16 echo "Downloading $name" 17 18 if [ $(expr $i % 4) -eq 0 ]; then 19 echo "Waiting..." 20 wait 21 fi 22 done 23 24 for f in *.mp4; do ffmpeg -i "$f" -acodec libmp3lame -vn -b:a 320k "${f%.mp4}.mp3"; done