1
0
mirror of https://github.com/acgnhiki/blrec.git synced 2025-04-15 07:43:23 +08:00

fix: live check_connectivity behaviour

This commit is contained in:
imkero 2024-04-23 01:08:11 +08:00 committed by acgnhiki
parent 772eb5e3e7
commit 1206d6e80f

View File

@ -175,11 +175,13 @@ class Live:
async def check_connectivity(self) -> bool:
try:
await self._session.head('https://live.bilibili.com/', timeout=3)
except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
return False
else:
await self._session.head('https://live.bilibili.com/', timeout=3, headers={
'User-Agent': self._user_agent,
})
return True
except Exception as e:
self._logger.warning(f'Check connectivity failed: {repr(e)}')
return False
async def update_info(self, raise_exception: bool = False) -> bool:
return all(