From e7150226c62938be1fd03e68beafa09272ff6832 Mon Sep 17 00:00:00 2001 From: "home@pookz.com" Date: Mon, 11 Nov 2024 17:17:28 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=B2=97=E7=B3=99=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=8C=E5=B0=81=E9=9D=A2=E4=B8=8A=E4=BC=A0=EF=BC=8C?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=BA=861=E4=B8=AAtimeout=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E9=82=A3=E4=B9=88=E5=A4=9A=E6=97=B6=E9=97=B4=E8=AE=A9=E5=85=B6?= =?UTF-8?q?=E6=9B=B4=E5=90=88=E7=90=86=EF=BC=8C=E6=9C=89=E6=84=BF=E6=84=8F?= =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E7=9A=84=E6=8F=90pr=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uploader/douyin_uploader/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/uploader/douyin_uploader/main.py b/uploader/douyin_uploader/main.py index b9cb231..67ef39a 100644 --- a/uploader/douyin_uploader/main.py +++ b/uploader/douyin_uploader/main.py @@ -152,7 +152,7 @@ class DouYinVideo(object): # 判断重新上传按钮是否存在,如果不存在,代表视频正在上传,则等待 try: # 新版:定位重新上传 - number = await page.locator('[class^="upload-btn"] div:has-text("重新上传")').count() + number = await page.locator('[class^="long-card"] div:has-text("重新上传")').count() if number > 0: douyin_logger.success(" [-]视频上传完毕") break @@ -211,11 +211,15 @@ class DouYinVideo(object): if thumbnail_path: await page.click('text="选择封面"') await page.wait_for_selector("div.semi-modal-content:visible") - await page.click('text="上传封面"') + await page.click('text="设置竖封面"') + await page.wait_for_timeout(2000) # 等待2秒 # 定位到上传区域并点击 await page.locator("div[class^='semi-upload upload'] >> input.semi-upload-hidden-input").set_input_files(thumbnail_path) await page.wait_for_timeout(2000) # 等待2秒 - await page.locator("div[class^='uploadCrop'] button:has-text('完成')").click() + finish_confirm_element = page.locator("div[class^='confirmBtn'] >> div:has-text('完成')") + if await finish_confirm_element.count(): + await finish_confirm_element.click() + await page.locator("div[class^='footer'] button:has-text('完成')").click() async def set_location(self, page: Page, location: str = "杭州市"): # todo supoort location later