我正在下载一个播放列表,其中有一些隐藏的视频,所以python给了我DownloadError,我想立即下载整个播放列表。有解决办法吗。我在试着让它忽略那些隐藏的视频
我的守则:
from yt_dlp import YoutubeDL
url = 'https://www.youtube.com/playlist?list=PLzMXToX8KzqhKrURIhVTJMb0v-HeDM3gs'
ydl_opts = {'format': 'mp4'}
with YoutubeDL(ydl_opts) as ydl:
ydl.download(url)
终端中的错误:
Enter your URL: https://youtube.com/playlist?list=PLzMXToX8KzqhKrURIhVTJMb0v-HeDM3gs
[youtube:tab] PLzMXToX8KzqhKrURIhVTJMb0v-HeDM3gs: Downloading webpage
WARNING: [youtube:tab] YouTube said: INFO - 8 unavailable videos are hidden
[youtube:tab] PLzMXToX8KzqhKrURIhVTJMb0v-HeDM3gs: Downloading API JSON with unavailable videos
WARNING: [youtube:tab] YouTube said: INFO - Unavailable videos will be hidden during playback
[download] Downloading playlist: English Grammar
[youtube:tab] playlist English Grammar: Downloading 52 videos
[download] Downloading video 1 of 52
[youtube] JGXK_99nc5s: Downloading webpage
[youtube] JGXK_99nc5s: Downloading android player API JSON
ERROR: [youtube] JGXK_99nc5s: Private video. Sign in if you've been granted access to this video
发布于 2022-04-27 18:40:17
根据我对文档的理解,我认为这将满足您的需要--不幸的是,我目前无法测试它,所以如果它不起作用,请告诉我:
import yt_dlp
ydl_opts = {
'ignoreerrors': True
}
url = 'https://www.youtube.com/playlist?list=PLzMXToX8KzqhKrURIhVTJMb0v-HeDM3gs'
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
error_code = ydl.download(url)
https://stackoverflow.com/questions/72033491
复制相似问题