From 3ef4cd322a76f18f1efeacf3855f1258d1813885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=BA=E8=A1=8Colo?= Date: Sat, 30 May 2026 02:11:38 -0700 Subject: [PATCH] =?UTF-8?q?fix(tencent):=20=E8=A7=86=E9=A2=91=E5=8F=B7?= =?UTF-8?q?=E3=80=8C=E5=A3=B0=E6=98=8E=E5=8E=9F=E5=88=9B=E3=80=8D=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E6=97=B6=E8=B7=B3=E8=BF=87=E8=80=8C=E9=9D=9E=E4=B8=AD?= =?UTF-8?q?=E6=AD=A2=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 视频号原创声明是可选项,但 apply_original_statement 在未找到声明入口时 会 raise RuntimeError 中止整个发布。在改版后的发布页(部分账号用 wujie 微前端,DOM 结构不同)经常匹配不到入口,导致本可正常发布的视频全部失败。 改为:未找到声明入口时记录 warning 并继续发布,不再中止。同时给诊断分支的 body 定位加 .first,避免页面存在多个 时 Playwright strict mode 崩溃。 Co-Authored-By: Claude Opus 4.8 --- uploader/tencent_uploader/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uploader/tencent_uploader/main.py b/uploader/tencent_uploader/main.py index 1f35c03..24ec42a 100644 --- a/uploader/tencent_uploader/main.py +++ b/uploader/tencent_uploader/main.py @@ -627,12 +627,13 @@ class TencentBaseUploader(BaseVideoUploader): try: diagnostic_path = Path(BASE_DIR) / "debug_tencent_original_missing.png" await page.screenshot(path=str(diagnostic_path), full_page=True) - visible_text = (await page.locator("body").inner_text())[-4000:] + visible_text = (await page.locator("body").first.inner_text())[-4000:] tencent_logger.warning(_msg("😵", f"未确认声明原创,诊断截图: {diagnostic_path}")) tencent_logger.warning(_msg("🧾", f"页面末尾文本: {visible_text}")) except Exception as exc: tencent_logger.warning(_msg("😵", f"生成原创声明诊断信息失败: {exc}")) - raise RuntimeError("未能在视频号发布页找到并设置“声明原创”,已停止发布") + # 视频号「声明原创」为可选项:页面无对应入口时跳过并继续发布,而非中止。 + tencent_logger.warning(_msg("📭", "本视频未声明原创(页面无入口或为可选项),跳过并继续发布")) async def wait_for_upload_complete(self, page: Page) -> None: while True: