0

嗨,我有一个查找视频流的 python 脚本,如果找到该流,它将执行某些操作。

当 streamlink 找不到流时,它会显示一条消息(这是标准功能)“无法获取视频信息 - 错误:视频不可用”。

在文档中,它说您可以写入日志文件,但我不知所措......这就是我所说的

 streams = streamlink.streams (channel_stream)

如何完成该语句以将流链接记录到 /var/stramlink.log

提前致谢。H

4

1 回答 1

0

文档看来,您可以使用会话实例在流链接会话上设置日志文件设置:

subprocess-errorlog (bool) Log errors from subprocesses to a file located in the temp directory

subprocess-errorlog-path (str) Log errors from subprocesses to a specific file

ffmpeg-verbose (bool) Log stderr from ffmpeg to the console

ffmpeg-verbose-path (str) Specify the location of the ffmpeg stderr log file

这些设置可以设置为:

streamlink.set_option('subprocess-errorlog', true)
streamlink.set_option('subprocess-errorlog-path', '/path/to/streamlink_error.log')
streamlink.set_option('ffmpeg-verbose', true)
streamlink.set_option('ffmpeg-verbose-path', '/path/to/ffmpeg_error.log')
于 2021-08-04T03:50:15.790 回答