I have been using

youtube-dl -c -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' https://www.youtube.com/playlist?list=PLgsYTUetbpwNRmhee8yc_4o4MTY_naAmO

to download a playlist from YouTube, but I was wondering if there is a way I can, for example, download videos 2 through 8 (out of a playlist of 10 for example) or the first 5 videos or the last 6 videos or even from video 7 onward?

Is there a way this can be done using youtube-dl?

up vote 8 down vote accepted

You can use: --playlist-start, --playlist-end, --playlist-reverse or --playlist-items to achieve this goal.

For example to download 2 through 8:

youtube-dl -c -f '...' --playlist-start 2 --playlist-end 8 https://youtube.com/watch/foo

To download first 5:

youtube-dl -c -f '...' --playlist-end 5 https://youtube.com/watch/foo

From 7 onward:

youtube-dl -c -f '...' --playlist-start 7 https://youtube.com/watch/foo

Or to download 2,4,6:

youtube-dl -c -f '...' --playlist-items 2,4,6 https://youtube.com/watch/bar

Or even specify a range of videos:

youtube-dl -c --playlist-items 2-3,5,8-10,18 https://youtube.com/watch/bar

To get the last ones you should use --playlist-reverse, for example for last 6:

youtube-dl -c -f '...' --playlist-end 6 --playlist-reverse
  • thanks for the help. this is great. Just another question... Say I'm downloading from a batch file, and in that batch file there is a link to a playlist, is something like what you mentioned above possible in this scenario? – natral Sep 12 at 18:48
  • 1
    @natral I'm not sure about it... I have to test and see what happens :) – Ravexina Sep 12 at 19:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.