youtube-dl how to download multiple playlists in individual folders

7,120

Solution 1

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'

Solution 2

In case people from the future stumbled upon this post, I've found a solution working on Windows. Don't know about other OS though.

In your x:\Users\USERNAME\ , create or edit a file named youtube-dl.conf and paste the commands below. This would always run in youtube-dl so you don't have to type it in the terminal. For more info about the config file.

-o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'

After that, create a text file containing the playlist links separated by a line and run this.

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

After downloading, you're free to delete the commands in youtube-dl.confif you don't need it.

Share:
7,120

Related videos on Youtube

Miguel Sanchez
Author by

Miguel Sanchez

Updated on September 18, 2022

Comments

  • Miguel Sanchez
    Miguel Sanchez almost 2 years

    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 ?

  • Miguel Sanchez
    Miguel Sanchez over 7 years
    yes I have one url per line ... and I should have mentiond it earlier but i'm doing this on a windows system..
  • Michael D.
    Michael D. over 7 years
    Either install cygwin and use that line above, or install microsoft powershell and ask a new question how to translate that line to powershell.
  • Miguel Sanchez
    Miguel Sanchez over 7 years
    In powershell you can do $downloadLinks = Get-Content download.txt and then loop thru each of those lines using foreach($downloadLink in $downloadLinks) and then do whatever processing you want in the foreach loop
  • Denis
    Denis over 3 years
    this works so well.
  • Hashim Aziz
    Hashim Aziz over 2 years
    The config file is not a necessary part of this - you can simply include the -o switch when running the command on the command line. The config file is for command-line switches you use often enough to avoid typing them on the command line. I would also recommend anyone using YouTube-DL in 2021 to migrate to the yt-dlp fork, which is actively developed, more reliable, and much more fully featured. The sole developer of YouTube-DL went on a very long hiatus leaving the project essentially buried compared to the work other forks have done on top of it.