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/"))