Search code examples
pythonyoutube-dl

Can youtube-dl perform multiple downloads to different directories?


Youtube-dl runs with python

I would like to download multiple YouTube playlists (using the archive feature), but I want those to be downloaded to different local directories.

I can get this to work for one playlist going to one directory:

 youtube-dl --download-archive "F:\Videos\Online Videos\Comics
 Explained\Marvel Major Storylines (Constantly Updated)\Marvel Major
 Storylines Archive.txt"
 "https://www.youtube.com/playlist?list=PL9sO35KZL50yZh5dXW-7l93VZp7Ct4vYA"
 -o "F:\Videos\Online Videos\Comics Explained\%(playlist_title)s\%(title)s.%(ext)s" -f
 "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"
 --ffmpeg-location "H:\Documents\FFMpeg\bin"

but I don't know if I can do this for multiple playlists going to a separate directory for each playlist.


Solution

  • Your invocation already does create multiple directories, one for each playlist, simply by using template sequences such as %(playlist_title)s in your -o parameter. The only thing that's missing is multiple playlists. Fortunately, you can just append the playlist URLs to your command line, like this:

    youtube-dl \
      --download-archive "F:\Videos\Online Videos\Comics Explained\Marvel Major Storylines (Constantly Updated)\Marvel Major Storylines Archive.txt"
      -o "F:/Videos/Online Videos/Comics Explained/%(playlist_title)s/%(title)s.%(ext)s" \
      -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
      --ffmpeg-location "H:\Documents\FFMpeg\bin" \
      \
      PL9sO35KZL50yZh5dXW-7l93VZp7Ct4vYA \
      https://www.youtube.com/playlist?list=YOUR_PLAYLIST_HERE \
      https://www.youtube.com/playlist?list=YOUR_SECOND_PLAYLIST_HERE \
      ...
    

    (The backslashes at the end of lines are not needed if you write the whole command in one line)