Youtube dl how to download all playlist devided into different foledrs?

In Youtube-dl, i need path for download one playlist with one folder for one different video! and every video need to start name with his number (1 for first and his name; 8 for eighth and his name... )

2 Answers

#!/bin/bash
echo "Downloading playlist...(results.log)"
youtube-dl -j --flat-playlist "$1" | jq -r '.id' | sed 's_^_https:// > results.log
num=1
total="$(wc -l < results.log)"
echo "Total videos: $total"
while [ "$num" -le "$total" ]; do echo "Processing video #$num Thank you for Patience" url="$(sed -n "$num"p results.log)" title=$(youtube-dl -f mp4 -o '%(id)s.%(ext)s' --print-json --no-warnings "$url" | jq -r .title) echo "Title is $title" title="$num. $title" fly='"' title=$fly"$title"$fly echo "New title is $title" echo "URL is $url" sleep 5 file_name="$(youtube-dl --get-filename --simulate $url)" ext="${file_name##*.}" echo "ext is $ext" youtube-dl -f best --output $num.$ext $url sleep 5 mkdir "$title" mv $num.$ext ./"$title" echo "please wait" sleep 1 num=$(( num+1 ))
done
#some Housekeeping !!
for i in *; do mv "$i" "`echo $i | sed 's/"/ /'`" 2>/dev/null; done
for i in *; do mv "$i" "`echo $i | sed 's/"/ /'`" 2>/dev/null; done
for i in *; do mv "$i" "`echo $i | sed 's/ / /'`" 2>/dev/null; done
1
#!/bin/bash
#Download playlist
youtube-dl -j --flat-playlist "" | jq -r '.id' | sed 's_^_https:// > result.log
#set video count=1
num=1
total="$(wc -l result.log)"
while ( $num -le $total)
do
url="$(sed -n "$num"p result.log)"
#%(title)s should give video title
youtube-dl -f 18 --output $num_"%(title)s.%(ext)s" $url

References:- 1.radiolondra: 2.maythux:How to specify a filename while extracting audio using youtube-dl?

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like