59

How to download playlist using youtube-dl from start certain number to an upper limit?

I tried to use in the code:

youtube-dl -o '~/Documents/%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s - %(title)s.%(ext)s' URL

and it stopped in the middle. I want to restart the process from the index ith numbered video, and not have it start over from the beginning.

martineau
  • 119,623
  • 25
  • 170
  • 301
hadar
  • 824
  • 2
  • 8
  • 10

4 Answers4

95

youtube-dl --help, contains:

Video Selection:
  --playlist-start NUMBER          Playlist video to start at (default is 1)
  --playlist-end NUMBER            Playlist video to end at (default is last)
  --playlist-items ITEM_SPEC       Playlist video items to download. Specify
                                   indices of the videos in the playlist
                                   separated by commas like: "--playlist-items
                                   1,2,5,8" if you want to download videos
                                   indexed 1, 2, 5, 8 in the playlist. You can
                                   specify range: "--playlist-items
                                   1-3,7,10-13", it will download the videos
                                   at index 1, 2, 3, 7, 10, 11, 12 and 13.

Thus, the option --playlist-start NUMBER should help you to start the playlist in the middle, specified by NUMBER.

Adi Prasetyo
  • 1,006
  • 1
  • 15
  • 41
Heiko Oberdiek
  • 1,598
  • 10
  • 12
  • Thank you very much, it helped me a lot.. but how do I count the video from a certain number? This downloads me the right video but from number 1 and not from the NUMBER number I inserted – hadar Jun 18 '17 at 00:12
19

I have total 135 videos in my playlist. I have successfully downloaded 38 of them. So I manually used this command.

youtube-dl --playlist-start 39 -u uname@gmail.com -p mypassword https://www.udemy.com/learn-ethical-hacking-from-scratch/learn/v4/content

Its downloading my remaining 97 videos.

Ravi Yadav
  • 2,296
  • 3
  • 25
  • 32
  • I am getting `ERROR: Unable to download webpage: (caused by URLError(SSLError(1, '_ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERV ER_HELLO:tlsv1 alert protocol version'),))` could you please help me download the videos. – Hunterr Jun 16 '18 at 18:01
  • @HunterrJ can you please mention the command that you are using to download – Ravi Yadav Jun 18 '18 at 06:36
  • I tried, `D:\tutorials>youtube-dl -u email -p password https://www.udemy.com/data-analysis-with-pandas/learn/v4/` – Hunterr Jun 21 '18 at 15:47
  • @HunterrJ have you tried appending "--playlist-start 1" to start from the first video? – Ravi Yadav Jun 22 '18 at 06:02
  • @HunterrJ First you have to install the python script then only you can run the command – Ravi Yadav Jun 29 '18 at 06:01
  • Even I tried executing the python script. `def youtube(url): import youtube_dl ydl_opts = { 'verbose': False, 'format': '22/best', 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'noplaylist': False, 'playliststart' : 1, 'u':'username', 'p':'password' } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url])` Still throws same error. – Hunterr Jun 30 '18 at 08:26
1

This helped:

youtube-dl -f best <playlist link> --playlist-start 15

-f best selects the best video formats. use youtube-dl --help for more options

redolF
  • 51
  • 3
0

Adding on top of the above answers. If you are looking only to download the audio formats like m4a, then following command will work best. Even with playlist, and providing the start and end indices. Also the M4a format file size is smaller.

youtube-dl -i -f mp4 --yes-playlist --playlist-start 'start_index' 'https://www.youtube.com/watch?v=7Vy8970q0Xc&list=PLwJ2VKmefmxpUJEGB1ff6yUZ5Zd7Gegn2'

Using the inbuilt audio formats before ffmpeg can reduce the time required to enjoy the music or the video. In background you can get a better formats