mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-26 21:00:15 +08:00
修复cookie导致的获取头像失败
This commit is contained in:
parent
914a41700e
commit
b98a8f6680
@ -312,7 +312,6 @@ class RoomInfoHandler(api.base.ApiHandler): # noqa
|
||||
'Origin': 'https://live.bilibili.com',
|
||||
'Referer': f'https://live.bilibili.com/{room_id}'
|
||||
},
|
||||
cookies=utils.request.BILIBILI_COMMON_COOKIES,
|
||||
params={
|
||||
'room_id': room_id
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ async def get_avatar_url(user_id):
|
||||
|
||||
|
||||
async def get_avatar_url_or_none(user_id):
|
||||
if user_id == 0:
|
||||
return None
|
||||
|
||||
avatar_url = get_avatar_url_from_memory(user_id)
|
||||
if avatar_url is not None:
|
||||
return avatar_url
|
||||
@ -169,7 +172,6 @@ async def _do_get_avatar_url_from_web(user_id):
|
||||
'Origin': 'https://space.bilibili.com',
|
||||
'Referer': f'https://space.bilibili.com/{user_id}/'
|
||||
},
|
||||
cookies=utils.request.BILIBILI_COMMON_COOKIES,
|
||||
params=_add_wbi_sign({'mid': user_id}),
|
||||
) as r:
|
||||
if r.status != 200:
|
||||
|
@ -5,18 +5,8 @@ import aiohttp
|
||||
BILIBILI_COMMON_HEADERS = {
|
||||
'Origin': 'https://www.bilibili.com',
|
||||
'Referer': 'https://www.bilibili.com/',
|
||||
'Sec-CH-UA': '"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"',
|
||||
'Sec-CH-UA-Mobile': '?0',
|
||||
'Sec-CH-UA-Platform': '"Windows"',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)'
|
||||
' Chrome/105.0.0.0 Safari/537.36'
|
||||
}
|
||||
BILIBILI_COMMON_COOKIES = {
|
||||
'b_lsid': '639B17D4_9876590D28',
|
||||
'_uuid': '883B5256-A359-E4A3-7159-123456794937E96237infoc'
|
||||
' Chrome/114.0.0.0 Safari/537.36'
|
||||
}
|
||||
|
||||
http_session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10))
|
||||
|
Loading…
Reference in New Issue
Block a user