INNER CODE UNIT · Python

_fetch_cookies

1837620622/cloudflare-bypass-2026 · bypass_nodriver.py:144

async def _fetch_cookies(browser, tab) -> List[Any]:
    """
    获取 Cookie 列表。
    nodriver 的 tab.send(network.get_cookies()) 返回 List[Cookie],不是 dict。
    """
    # 优先使用 Browser.cookies 高阶 API(若存在)
    try:
        if browser is not None and hasattr(browser, "cookies"):
            jar = browser.cookies
            if hasattr(jar, "get_all"):
                items = await jar.get_all()
                if items:
                    return list(items)
    except Exception as e:
        print(f"[*] browser.cookies 不可用: {e}")

    cookies_raw = await tab.send(uc.cdp.network.get_cookies())
    if isinstance(cookies_raw, dict):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…