Youtube-dl how to download multiple playlists in individual folders

downloadyoutubeyoutube-dl

With youtube-dl I can do

# Download YouTube playlist videos in separate directory indexed by video order in a playlist
$ youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re

the above script downloads the playlist by creating a folder with the name of the playlist and then downloads the individual videos into that folder.

I also can do

$ youtube-dl -citw --batch-file=downloads.txt

this script downloads all the video urls list in the batch file, the file can contain playlists as well as individual url's and youtube-dl downloads all videos in the current directory.

I now somehow want to marry both of these.
If i have a text file containing playlist links. I want to download all those playlist in to its own folder like I do with the 1st command.

Can I do that with youtube-dl ?

Best Answer

If downloads.txt contains one url per line try:

cat downloads.txt | xargs -n1 youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'
Related Question