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

YoutubeResumeYoutube Dl

Youtube Problem Overview


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

Youtube Solutions


Solution 1 - Youtube

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.

Solution 2 - Youtube

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

Solution 3 - Youtube

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

Solution 4 - Youtube

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>

Solution 5 - Youtube

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

Solution 6 - Youtube

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:

sudo youtube-dl -f best link_to_your_video_here

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

sudo youtube-dl -c -f best link_to_your_video_here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpelagosView Question on Stackoverflow
Solution 1 - Youtubesrinivasu uView Answer on Stackoverflow
Solution 2 - YoutubeBeevkView Answer on Stackoverflow
Solution 3 - YoutubeGian LuccaView Answer on Stackoverflow
Solution 4 - YoutubeAkash KandpalView Answer on Stackoverflow
Solution 5 - YoutubeSalimView Answer on Stackoverflow
Solution 6 - YoutubeUdesh RanjanView Answer on Stackoverflow