21

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?

1 Answer 1

38

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
2
  • 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, 2018 at 18:48
  • 1
    @natral I'm not sure about it... I have to test and see what happens :)
    – Ravexina
    Sep 12, 2018 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .