61

I am using youtube-dl to download videos from Lynda (I have an account).

After about the 40th video in a list I received this error:

ERROR: Unable to download JSON metadata: HTTP Error 403: Forbidden

Is there a way to 'restart' the downloads so I don't have to start from the first file again? Say just tell it to start from file 41 or something?

This is the command I used to download:

./youtube-dl --cookies cookies.txt --username <myusername> --password <mypassword> --sleep-interval 200 -o "%(autonumber)s - %(title)s.%(ext)s” http://www.lynda.com/C-tutorials/C-Essential-Training/188207-2.html
Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
pelagos
  • 1,025
  • 3
  • 17
  • 27

6 Answers6

99

It's good to use a combination of -ciw when downloading playlists.

-i, --ignore-errors    Continue on download errors, for example to skip
                       unavailable videos in a playlist
-w, --no-overwrites    Do not overwrite files
-c, --continue         Force resume of partially downloaded files.
                       By default, youtube-dl will resume downloads if possible.

The following example downloads top 100 songs on YouTube Music

youtube-dl -ciw --playlist-items 1-100 --extract-audio --audio-format mp3 --restrict-filenames https://www.youtube.com/playlist?list=PLDcnymzs18LWrKzHmzrGH1JzLBqrHi3xQ

The actual link to Youtube Music playlist varies with time, I guess. You can go the the playlist and copy. One way to check whether a link refers to a playlist or a single video, is that the playlist link has "playlist" keyword in it.

srinivasu u
  • 1,393
  • 11
  • 12
  • 6
    Can you explain why "--continue" would be useful? If the default to is to continue if "possible", why would you want to force it if it is not possible? And when exactly would it not be possible? – Sharpiro Dec 26 '19 at 16:51
  • 1
    That didn't work for me. Maybe because I specified an option to reencode the files ? – elig May 12 '20 at 20:30
  • @Sharpiro practically every option that is a toggle has a "negate" option. So for example, you might want to override a "--no-continue" option that you might have set as a default in the config. I'd imagine it would not be possible to continue if the server node that gets used doesn't support downloading at arbitrary positions and the video itself isn't already fragmented (in that case you can start at a specific fragment). – Jeff Mercado Oct 21 '22 at 03:25
27

You can continue the download using:

youtube-dl <link_to_video> -c

Or

youtube-dl <link_to_video> --continue

Also, youtube-dl mostly continues the download whenever possible

Bivek
  • 1,380
  • 10
  • 24
  • 2
    didnt work for me. it starts over again. my command "youtube-dl -c --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s"" – M. Usman Khan May 21 '18 at 15:14
14

Download specific videos from playlist This is yet another useful feature of Youtube-dl. It allows us to download a specific song(s) from a playlist that contains 100s of songs.

For example, to download the 10th file from a playlist, run:

$ youtube-dl --playlist-items 10 <playlist_url>

Similarly, to download multiple random files, just specify indices of the videos in the playlist separated by commas like below::

$ youtube-dl --playlist-items 2,3,7,10 <playlist_url>

You can also specify the range of songs. To download a video playlist starting from a certain video, say 10, to end:

$ youtube-dl --playlist-start 10 <playlist_url>

To download only the files starting from 2nd to 5th in a playlist, use:

$ youtube-dl --playlist-start 2 --playlist-end 5 <playlist_url>

You should do like this if it is a playlist with 200 videos and it stuck at the 127 also use the -ciw in the same order below to avoid it from stop during errors.

 youtube-dl -ciw --playlist-start 127 <then past the playlist link after the 127>

To download only the audio from the video do this

youtube-dl -ciw -x --audio-format mp3 --playlist-start 127 <then past the playlist link after the 127>

for example:

youtube-dl -ciw -x --audio-format mp3 --playlist-start 127 https://www.youtube.com/playlist?list=PLjzdNLPsCsPeeO49mvhHP5uyKdYkAbON8
Gian Lucca
  • 141
  • 1
  • 2
5

You can resume a video with -c option. For instance, if you previously started a download using:

youtube-dl <some_youtube_URL>

You may, if it was stopped or interrupted, resume that download later with:

youtube-dl -c <some_youtube_URL>
Akash Kandpal
  • 3,126
  • 28
  • 25
4

To resume downloading your video use -c(continue argument) if you have supplied any format while downloading the video you need to specify the same format with -c argument

I was downloading video:

youtube-dl -f best link_to_your_video_here

Then internet went off and to resume downloading the same video:

youtube-dl -c -f best link_to_your_video_here
Udesh
  • 2,415
  • 2
  • 22
  • 32
2

After all the arguments use the flag [--playlist-start (Number)] before the url. This will start the download at the specified number.

Salim
  • 21
  • 1