snippets/youtube-par-cmd
gutmet b5e168b0fe youtube: unify parallel downloads of pure audio and video
* also: dump titles in playlist order as txt
2020-10-13 22:31:08 +02:00

13 lines
515 B
Bash
Executable File

#!/usr/bin/env bash
# called from youtube-audio-par-dl and youtube-par-dl with corresponding download command
# only works with jq (command line JSON processor)
cmd="$1"
playlistURL="$2"
playlistJSON=`youtube-dl "$playlistURL" --flat-playlist -J`
playlistTitle=`echo "$playlistJSON" | jq -r '.title'`
echo "$playlistJSON" | jq -r '.entries[].title' >> "Playlist - $playlistTitle"".txt"
echo "$playlistJSON" | jq -r '.entries[].url' | awk '{print "https://www.youtube.com/watch?v=" $0}' | xargs -n 1 -P 10 "$cmd"