From 9976caf5d470826528da583edde94bc070b13994 Mon Sep 17 00:00:00 2001 From: suyiiyii Date: Thu, 24 Oct 2024 21:40:19 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8DB=E7=AB=99=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=8C=BF=E5=90=8DCookie=E9=80=BB=E8=BE=91-ExClimbWuzh?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_bison/platform/bilibili/scheduler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonebot_bison/platform/bilibili/scheduler.py b/nonebot_bison/platform/bilibili/scheduler.py index 016f6275..2d48fd32 100644 --- a/nonebot_bison/platform/bilibili/scheduler.py +++ b/nonebot_bison/platform/bilibili/scheduler.py @@ -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