From 9065b58516f9ec33accc9d710e585669d081c1b3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 16 Oct 2025 11:04:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E8=B5=9E=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spider/task.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spider/task.py b/spider/task.py index 9c18d2c..136527e 100644 --- a/spider/task.py +++ b/spider/task.py @@ -291,15 +291,12 @@ def playwright_like(cookies, target_url): retry_goto(page, url) time.sleep(random.randint(3, 10)) - if 'permalink.php?story_fbid' in target_url or '/posts/' in target_url: + if 'permalink.php?story_fbid' in target_url or '/permalink/' in target_url or '/posts/' in target_url: # 文字或图片类型 button_xpath = '//*[@role="dialog"]//span[text()="Like" or @data-ad-rendering-role="like_button"]' elif 'watch/?v' in target_url or '/videos/' in target_url: # 视频类型, 视频类型, button_xpath = '//span[@data-ad-rendering-role="like_button"][1]' - elif '/permalink/' in target_url: - # 永久链接 - button_xpath = '//*[@role="dialog"]//span[@data-ad-rendering-role="like_button"]' elif '/reel/' in target_url: # 短视频类型 button_xpath = '//div[@class="__fb-dark-mode x1afcbsf x1uhb9sk x1swf91x"]//div[@aria-label="Like"]//div[@aria-label="Like"]' @@ -1071,7 +1068,7 @@ if __name__ == '__main__': # print(playwright_get_user_profile(cookies)) # # 永久链接的帖子点赞 # print(playwright_like(cookies, "https://www.facebook.com/groups/1070754870427928/permalink/1873461830157224/")) - print(playwright_like(cookies, "https://www.facebook.com/permalink.php?story_fbid=pfbid037z3vCbfQXaohJT3P2Td7oKfgEZ7uKBG2zt7FktDwarsx5DftReNBrks1SuRwzApFl&id=61556406998616")) + print(playwright_like(cookies, "https://www.facebook.com/groups/267112859525987/permalink/658047397099196/?rdid=LETw8B1KYb7eUKUJ")) # # # # 视频链接的帖子点赞 # print(playwright_like(cookies, "https://www.facebook.com/groups/1070754870427928/permalink/1873461830157224/"))