fix:粗糙修复,封面上传,加入了1个timeout,没那么多时间让其更合理,有愿意贡献的提pr优化
This commit is contained in:
@@ -152,7 +152,7 @@ class DouYinVideo(object):
|
|||||||
# 判断重新上传按钮是否存在,如果不存在,代表视频正在上传,则等待
|
# 判断重新上传按钮是否存在,如果不存在,代表视频正在上传,则等待
|
||||||
try:
|
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:
|
if number > 0:
|
||||||
douyin_logger.success(" [-]视频上传完毕")
|
douyin_logger.success(" [-]视频上传完毕")
|
||||||
break
|
break
|
||||||
@@ -211,11 +211,15 @@ class DouYinVideo(object):
|
|||||||
if thumbnail_path:
|
if thumbnail_path:
|
||||||
await page.click('text="选择封面"')
|
await page.click('text="选择封面"')
|
||||||
await page.wait_for_selector("div.semi-modal-content:visible")
|
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.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.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 = "杭州市"):
|
async def set_location(self, page: Page, location: str = "杭州市"):
|
||||||
# todo supoort location later
|
# todo supoort location later
|
||||||
|
|||||||
Reference in New Issue
Block a user