🐛 修复B站获取匿名Cookie逻辑 (#644)

This commit is contained in:
suyiiyii 2024-10-28 21:47:04 +08:00 committed by GitHub
parent 08ba7b0e3b
commit a671bd0c61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,9 @@ class BilibiliClientManager(ClientManager):
browser = await get_browser()
async with await browser.new_page() as page:
await page.goto(f"https://space.bilibili.com/{random.randint(1, 1000)}/dynamic")
await page.wait_for_load_state("load")
await page.wait_for_load_state("load") # 等待基本加载完成
await page.wait_for_function('document.cookie.includes("bili_ticket")') # 期望保证 GenWebTicket 请求完成
await page.wait_for_load_state("networkidle") # 期望保证 ExClimbWuzhi 请求完成
cookies = await page.context.cookies()
return cookies