From ac4a6c394b5876308e1c446b7a268a14cc440311 Mon Sep 17 00:00:00 2001 From: work Date: Thu, 9 Apr 2026 08:32:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=84=E8=AE=BA=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE=E5=8F=98=E6=9B=B4?= =?UTF-8?q?,=20=E5=A2=9E=E5=8A=A0=E8=AF=84=E8=AE=BA=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spider/task.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spider/task.py b/spider/task.py index 520334a..cc113ee 100644 --- a/spider/task.py +++ b/spider/task.py @@ -604,9 +604,19 @@ def playwright_comment(cookies, target_url, content, image_key=None): with sync_playwright() as playwright: update_windows_distinguish() + username = 'moremore_51WM1' + password = 'TOv5y0nXCZH_JH+5' + country = 'US' + browser = playwright.chromium.launch( - headless=False, args=['--start-maximized'], executable_path=path + headless=False, args=['--start-maximized'], executable_path=path, + proxy={ + "server": "http://pr.oxylabs.io:7777", # 必填 + "username": f"customer-{username}-cc-{country}", + "password": password + } ) + context = browser.new_context(no_viewport=True) context.add_cookies(parse_cookies(cookies)) page = context.new_page() @@ -621,7 +631,7 @@ def playwright_comment(cookies, target_url, content, image_key=None): # 文字或图片类型 input_xpath = '//div[@role="dialog"]//span[text()="Comment" or@data-ad-rendering-role="comment_button"]' attach_xpath = '//div[@id="focused-state-actions-list"]//div[@aria-label="Attach a photo or video"]' - comment_xpath = '//div[@aria-label="Comment"]' + comment_xpath = '//div[@id="focused-state-composer-submit"]' page.click(input_xpath) sleep(1, 2) elif 'watch/?v' in target_url or '/videos/' in target_url: