fix(douyin): cookie 校验改有头,避免无头被反爬墙误判失效
cookie_auth 原硬编码 headless=True,但抖音无头会撞反爬墙→content/upload 跳登录→ 间歇性误报 cookie 失效(实测登录刚成功 90s 后校验即失败)。改 headless=False + 反检测 args。
This commit is contained in:
@@ -50,7 +50,11 @@ def _build_login_result(success: bool, status: str, message: str, account_file:
|
|||||||
|
|
||||||
async def cookie_auth(account_file):
|
async def cookie_auth(account_file):
|
||||||
async with async_playwright() as playwright:
|
async with async_playwright() as playwright:
|
||||||
browser = await playwright.chromium.launch(headless=True, channel="chrome")
|
# 抖音无头会撞反爬墙→content/upload 跳登录→误判 cookie 失效(间歇性)。校验必须有头。
|
||||||
|
browser = await playwright.chromium.launch(
|
||||||
|
headless=False, channel="chrome",
|
||||||
|
args=["--no-sandbox", "--disable-blink-features=AutomationControlled"],
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
context = await browser.new_context(storage_state=account_file)
|
context = await browser.new_context(storage_state=account_file)
|
||||||
context = await set_init_script(context)
|
context = await set_init_script(context)
|
||||||
|
|||||||
Reference in New Issue
Block a user