python - youtube_dl - 无法阻止发布错误日志

标签 python discord discord.py youtube-dl

如何防止打印 youtube_dl 错误日志?

[tls @ 0x5599ebcc8d00] Error in the pull function.
[https @ 0x5599ebcc65c0] Will reconnect at 98304 in 0 second(s), error=Input/output error.
[tls @ 0x5599ebff9cc0] Error in the pull function.
[https @ 0x5599ebcc65c0] Will reconnect at 2523120 in 0 second(s), error=Input/output error.
[tls @ 0x55e262434d00] Error in the pull function.
[https @ 0x55e2624325c0] Will reconnect at 131072 in 0 second(s), error=Input/output error.
[tls @ 0x556d70c28d00] Error in the pull function.
[https @ 0x556d70c265c0] Will reconnect at 131072 in 0 second(s), error=Input/output error.
[tls @ 0x5609e85e4d00] Error in the pull function.
[https @ 0x5609e85e25c0] Will reconnect at 131072 in 0 second(s), error=Input/output error.
[tls @ 0x555649486d00] Error in the pull function.
[https @ 0x5556494845c0] Will reconnect at 131072 in 0 second(s), error=Input/output error.
[tls @ 0x5647e561dd00] Error in the pull function.

我试过 'ignoreerrors': True 但它不起作用。

youtube_dl.utils.bug_reports_message = lambda: ''

YT_OPTIONS = {
    'format': 'bestaudio/best',
    'extractaudio': True,
    'audioformat': 'mp3',
    'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
    'restrictfilenames': True,
    'noplaylist': True,
    'nocheckcertificate': True,
    'ignoreerrors': True,
    'logtostderr': False,
    'quiet': True,
    'no_warnings': True,
    'default_search': 'auto',
    'source_address': '0.0.0.0',
}

我正在使用 this bot

最佳答案

这不是 youtube_dl 产生的错误,它来自 ffmpeg,因为您的 session 已过期。每个尝试流式传输音频而不从 YouTube 下载视频的人都会遇到这种情况。

通过删除 YouTube_dl 选项中的音频选项或将其添加到您的 ffmpeg 选项来下载视频。

https://github.com/Rapptz/discord.py/issues/671

'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5'

在复制开源代码之前,记得检查他们给出的问题、限制等。

关于python - youtube_dl - 无法阻止发布错误日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69515473/

相关文章:

python - 模块内的类

python - pytest:在线程中运行

javascript - 如何让 bot 将消息发送到 'general' channel 或消息最多的 channel ?

C++ CURL Json 请求不一致 API 以进行消息发布

python - 如何使用discord py连续编辑你的昵称

python - Discord.py(重写): Error Handling “Improper Token” In Function

python - 通过DictReader读取.csv

python - 我需要在第 n 个索引处插入一行,该行将对其下方的所有行进行求和

javascript - 使用discord.js,如何将 API 结果中不必要的部分切掉并发送?

python - 不和谐 py - 错误 : Unable to extract JS player URL