优化评论
Some checks failed
Update Code / StopService (windows-101.36.104.175) (push) Successful in 1s
Update Code / StopService (windows-101.36.102.136) (push) Successful in 0s
Update Code / CD (windows-101.36.104.175) (push) Failing after 2s
Update Code / CD (windows-101.36.102.136) (push) Failing after 2s

This commit is contained in:
work
2026-04-09 09:37:26 +08:00
parent ac4a6c394b
commit 3682f73ae7

View File

@@ -629,9 +629,9 @@ def playwright_comment(cookies, target_url, content, image_key=None):
if 'permalink.php?story_fbid' in target_url or '/posts/' in target_url or "/permalink/" in target_url: if 'permalink.php?story_fbid' in target_url or '/posts/' in target_url or "/permalink/" in target_url:
# 文字或图片类型 # 文字或图片类型
input_xpath = '//div[@role="dialog"]//span[text()="Comment" or@data-ad-rendering-role="comment_button"]' input_xpath = '//div[@role="dialog"]//span[text()="Comment" or @data-ad-rendering-role="comment_button"] | //div[@role="dialog"]//div[@aria-label="Write a comment…" and @role="textbox" and @contenteditable="true"]'
attach_xpath = '//div[@id="focused-state-actions-list"]//div[@aria-label="Attach a photo or video"]' attach_xpath = '//div[@id="focused-state-actions-list"]//div[@aria-label="Attach a photo or video"]'
comment_xpath = '//div[@id="focused-state-composer-submit"]' comment_xpath = '//div[@aria-label="Comment"] | //div[@id="focused-state-composer-submit"] | //div[@aria-label="Post comment" and @role="button"]'
page.click(input_xpath) page.click(input_xpath)
sleep(1, 2) sleep(1, 2)
elif 'watch/?v' in target_url or '/videos/' in target_url: elif 'watch/?v' in target_url or '/videos/' in target_url: