Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #259
问题现象
断网触发
ConnectionErrorHandler
后:aiohttp.client_exceptions.ClientResponseError: 412, message='Precondition Failed', url=URL('https://live.bilibili.com/')
,断网等待时间
设置项不生效问题原因
Live
中check_connectivity
方法未捕获所有异常,若请求https://live.bilibili.com/
失败,会导致异常抛出到ConnectionErrorHandler
的_wait_for_connection_error
导致重试与超时逻辑被打断blrec/src/blrec/bili/live.py
Lines 173 to 179 in 8dc32e5
blrec/src/blrec/core/operators/connection_error_handler.py
Lines 74 to 85 in 8dc32e5
Live
中check_connectivity
方法请求的 B 站直播首页https://live.bilibili.com/
有风控策略,当请求 UA 为 python requests 的 UA(例如python-requests/2.31.0
)时,会拦截并返回 412 状态码,导致check_connectivity
始终不能成功修复方法
check_connectivity
请求https://live.bilibili.com/
时带上用户指定的 UAcheck_connectivity
捕获 requests 请求时抛出的所有异常,若有异常则返回 False 并打印异常信息到 log 当中