youtube-dl, how do I resume a download after error?

pelagos picture pelagos · Mar 14, 2016 · Viewed 34.4k times · Source

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

Answer

srinivasu u picture srinivasu u · Nov 3, 2017

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.