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
How to use youtube-dl script to download starting from some index in a playlist?
提问by hadar
How to download playlist using youtube-dl
from 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 i
th numbered video, and not have it start over from the beginning.
它停在中间。我想从索引i
编号的视频重新开始该过程,而不是从头开始。
回答by Heiko Oberdiek
youtube-dl --help
contains:
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 NUMBER
should 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 个视频。