Skip to content

Commit

Permalink
🐛 修复B站获取匿名Cookie逻辑-ExClimbWuzhi
Browse files Browse the repository at this point in the history
  • Loading branch information
suyiiyii committed Oct 24, 2024
1 parent c9cd10b commit 9976caf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nonebot_bison/platform/bilibili/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ async def _get_cookies(self) -> list[Cookie]:
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_function('document.cookie.includes("bili_ticket")')
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
Expand Down

0 comments on commit 9976caf

Please sign in to comment.