获取账号信息使用代理

This commit is contained in:
work
2026-04-08 10:23:56 +08:00
parent 29ef1ebc34
commit 37f71e3a16

View File

@@ -644,8 +644,17 @@ def playwright_get_user_profile(cookies, username=None):
with login_semaphore: with login_semaphore:
with sync_playwright() as playwright: with sync_playwright() as playwright:
update_windows_distinguish() update_windows_distinguish()
username = 'moremore_51WM1'
password = 'TOv5y0nXCZH_JH+5'
country = 'US'
browser = playwright.chromium.launch( browser = playwright.chromium.launch(
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path headless=const.HEADLESS, 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 = browser.new_context(no_viewport=True)
context.add_cookies(parse_cookies(cookies)) context.add_cookies(parse_cookies(cookies))
@@ -1045,8 +1054,17 @@ def playwright_m_login(username, password, code_2fa=None):
# raise OperationFailed("获取代理失败") # raise OperationFailed("获取代理失败")
# logger.info(f"使用proxy={proxy_url}") # logger.info(f"使用proxy={proxy_url}")
username = 'moremore_51WM1'
password = 'TOv5y0nXCZH_JH+5'
country = 'US'
browser = playwright.chromium.launch( browser = playwright.chromium.launch(
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path headless=const.HEADLESS, args=['--start-maximized'], executable_path=path,
proxy={
"server": "http://pr.oxylabs.io:7777", # 必填
"username": f"customer-{username}-cc-{country}",
"password": password
}
) )
# random_user_agent = UserAgent().getBrowser(["Chrome Mobile iOS"]).get("useragent") # random_user_agent = UserAgent().getBrowser(["Chrome Mobile iOS"]).get("useragent")
random_user_agent = "Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Mobile Safari/537.36" random_user_agent = "Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Mobile Safari/537.36"