尝试下载discord.py music bot的某些视频时,会弹出清单错误

2024-06-17 13:25:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我想做一个不和谐的音乐机器人。我正在使用youtube dl检索信息,并使用ffmpeg播放音频。我的机器人下载视频没有问题,一切正常。但当我尝试下载某些视频时,出现了以下错误:

[dash @ 0x7fe45a801200] Manifest too large: 65055
https://manifest.googlevideo.com/api/manifest/dash/expire/1606336104/ei/CGq-X4G6Htauz7sPrZuCsA8/ip/14.192.212.39/id/64a943d43b8f53eb/source/youtube/requiressl/yes/playback_host/r5---sn-h5mpn-30ae.googlevideo.com/mh/Go/mm/31%2C29/mn/sn-h5mpn-30ae%2Csn-30a7rn7l/ms/au%2Crdu/mv/m/mvi/5/pl/24/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/533750/vprv/1/mt/1606314038/fvip/5/keepalive/yes/beids/23927369/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIhAOn6Br0QsuXc-3unfhYdzXVXcydzVWioIQlKvv2U4i3OAiB6ApoiqFoPvE3YKYGPbRiId_bHQYO8zsawGGPMidYGAA%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhANmxfRNBI4wSJo6trsKkq8GinQ-ADMxgHRmelBwM-GEAAiAafey9YRrZz1h1S6PzV3u0S6IsZUKscGrrGP9Pofv2uQ%3D%3D: Invalid data found when processing input

在尝试下载其他完全没有问题的视频后,我发现显示这些错误的视频有一个额外的步骤来下载MPD清单。我会尝试下载大得多的视频,而且会正常工作,但只有这些视频,持续时间大约7-10分钟,才会出现这些错误。我真的迷路了

这是我在语音频道播放视频的代码:

voice = get(client.voice_clients, guild = ctx.guild)
with YoutubeDL(ydl_opts) as ydl:
                info = ydl.extract_info(url[playlist], download = False)

URL = info['formats'][0]['url']
voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))

Tags: infocom视频youtube错误机器人audioyes
1条回答
网友
1楼 · 发布于 2024-06-17 13:25:25

我也面临着这个问题。在四处搜索时,我找到了以下线程:ffmpeg "Manifest too large" when downloading youtube video。所以我想做的是youtube-dl youtube-skip-dash-manifest,但是因为我们是从python运行它,所以有点不同。为了弄清楚我需要做什么,我使用了python shell:

$ python -i
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import youtube_dl as ytdl
>>> help(ytdl)

这带来了YoutubeDL的文档。键入“/”以开始搜索,然后键入搜索字符串。我搜索“清单”并按下回车键。它提到:

     |  youtube_include_dash_manifest: If True (default), DASH manifests and related
     |                      data will be downloaded and processed by extractor.
     |                      You can reduce network I/O by disabling it if you don't
     |                      care about DASH.

看起来这正是我需要的。然后,我在我的字典(你的ydl_opts)中包含了该键,如下所示:

ydl_opts = {
    'quiet': False,
    'default_search': 'ytsearch',
    'format': 'bestaudio/best',
    'youtube_include_dash_manifest': False,
}

这解决了我的问题,希望也解决了你的问题

相关问题 更多 >