How can I download part of a playlist from YouTube with 'youtube-dl'?
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
?
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