From 914a5f0910ca767f4c169aa888989a358831ed75 Mon Sep 17 00:00:00 2001 From: changyandao Date: Sat, 13 Jun 2026 18:23:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(douyin):=20cookie=20=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=94=B9=E6=9C=89=E5=A4=B4=EF=BC=8C=E9=81=BF=E5=85=8D=E6=97=A0?= =?UTF-8?q?=E5=A4=B4=E8=A2=AB=E5=8F=8D=E7=88=AC=E5=A2=99=E8=AF=AF=E5=88=A4?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cookie_auth 原硬编码 headless=True,但抖音无头会撞反爬墙→content/upload 跳登录→ 间歇性误报 cookie 失效(实测登录刚成功 90s 后校验即失败)。改 headless=False + 反检测 args。 --- uploader/douyin_uploader/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uploader/douyin_uploader/main.py b/uploader/douyin_uploader/main.py index 3927993..05b123e 100644 --- a/uploader/douyin_uploader/main.py +++ b/uploader/douyin_uploader/main.py @@ -50,7 +50,11 @@ def _build_login_result(success: bool, status: str, message: str, account_file: async def cookie_auth(account_file): 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: context = await browser.new_context(storage_state=account_file) context = await set_init_script(context)