youtube-par-cmd: fall back to playlist id if playlist title is weird
This commit is contained in:
parent
b5542893b4
commit
ceeb17d78b
|
@ -8,14 +8,21 @@ playlistURL="$2"
|
||||||
|
|
||||||
playlistJSON=`youtube-dl "$playlistURL" --flat-playlist -J`
|
playlistJSON=`youtube-dl "$playlistURL" --flat-playlist -J`
|
||||||
playlistTitle=`echo "$playlistJSON" | jq -r '.title'`
|
playlistTitle=`echo "$playlistJSON" | jq -r '.title'`
|
||||||
mkdir "$playlistTitle"
|
|
||||||
|
output="$(mkdir "$playlistTitle")"
|
||||||
|
status=$?
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
playlistTitle=`echo "$playlistJSON" | jq -r '.id'`
|
||||||
|
mkdir "$playlistTitle"
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$playlistTitle"
|
cd "$playlistTitle"
|
||||||
|
|
||||||
urls=`echo "$playlistJSON" | jq -r '.entries[].url'`
|
urls=`echo "$playlistJSON" | jq -r '.entries[].url'`
|
||||||
echo "$urls" | awk '{print "https://www.youtube.com/watch?v=" $0}' | xargs -n 1 -P 10 "$cmd"
|
echo "$urls" | awk '{print "https://www.youtube.com/watch?v=" $0}' | xargs -n 1 -P 10 "$cmd"
|
||||||
|
|
||||||
M3Ufile="Playlist - $playlistTitle"".m3u"
|
m3uFile="Playlist - $playlistTitle"".m3u"
|
||||||
echo "#EXTM3U" > "$M3Ufile"
|
echo "#EXTM3U" > "$m3uFile"
|
||||||
echo "$urls" | while read url; do
|
echo "$urls" | while read url; do
|
||||||
find . -name "*$url*" -prune >> "$M3Ufile"
|
find . -name "*$url*" -prune >> "$m3uFile"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user