Python 如何使用 youtube-dl 脚本从播放列表中的某个索引开始下载?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44610370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 00:13:33  来源:igfitidea点击:

How to use youtube-dl script to download starting from some index in a playlist?

pythonyoutube-dl

提问by hadar

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

如何使用youtube-dl从开始某个数字到上限来下载播放列表?

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.

它停在中间。我想从索引i编号的视频重新开始该过程,而不是从头开始。

回答by Heiko Oberdiek

youtube-dl --helpcontains:

youtube-dl --help包含:

...

  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.

...

...

  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, option --playlist-start NUMBERshould help you to start the playlist in the middle, specified by NUMBER.

因此,选项--playlist-start NUMBER应该可以帮助您在中间开始播放列表,由NUMBER.

回答by Ravi Yadav

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

我的播放列表中有 135 个视频。我已经成功下载了其中的 38 个。所以我手动使用了这个命令。

youtube-dl --playlist-start 39 -u [email protected] -p mypassword https://www.udemy.com/learn-ethical-hacking-from-scratch/learn/v4/content

Its downloading my remaining 97 videos.

它正在下载我剩余的 97 个视频。