Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
651 views
in Technique[技术] by (71.8m points)

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

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
question from:https://stackoverflow.com/questions/35982269/youtube-dl-how-do-i-resume-a-download-after-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...