From 2dbedcc2067b65b1e57301fe3b666e1eb9536013 Mon Sep 17 00:00:00 2001 From: Leo Song Date: Sat, 18 Oct 2025 13:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E9=93=BE=E6=8E=A5=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=EF=BC=8C=E5=85=B3=E6=8E=89=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uploader/douyin_uploader/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/uploader/douyin_uploader/main.py b/uploader/douyin_uploader/main.py index 9f29122..e0032ab 100644 --- a/uploader/douyin_uploader/main.py +++ b/uploader/douyin_uploader/main.py @@ -321,6 +321,15 @@ class DouYinVideo(object): return False await add_button.click() douyin_logger.debug("[+] 成功点击'添加链接'按钮") + ## 如果链接不可用 + await page.wait_for_timeout(2000) + error_modal = page.locator('text=未搜索到对应商品') + if await error_modal.count(): + confirm_button = page.locator('button:has-text("确定")') + await confirm_button.click() + # await page.wait_for_selector('.semi-modal-content', state='hidden', timeout=5000) + douyin_logger.error("[-] 商品链接无效") + return False # 填写商品短标题 if not await self.handle_product_dialog(page, product_title):