mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-03-12 10:40:57 +08:00
添加错误处理
This commit is contained in:
parent
da242fc853
commit
846e830f9c
2
blivedm
2
blivedm
@ -1 +1 @@
|
||||
Subproject commit 39fb86a9b20f8d94501dd2e25f16a1c573b1e33f
|
||||
Subproject commit 2f705b86ce02e4c8c93ca6d066964747160fd617
|
@ -31,6 +31,9 @@ async def get_avatar_url(user_id):
|
||||
return _avatar_url_cache[user_id]
|
||||
async with _http_session.get('https://api.bilibili.com/x/space/acc/info',
|
||||
params={'mid': user_id}) as r:
|
||||
if r.status != 200: # 可能会被B站ban
|
||||
logger.error('获取头像失败:status=%d %s uid=%d', r.status, r.reason, user_id)
|
||||
return 'https://static.hdslb.com/images/member/noface.gif'
|
||||
data = await r.json()
|
||||
url = data['data']['face']
|
||||
if not url.endswith('noface.gif'):
|
||||
|
Loading…
Reference in New Issue
Block a user