HEADLESS 放到常量中
This commit is contained in:
@@ -24,8 +24,6 @@ from const import BUCKET, BASE_PATH
|
||||
from exceptions import AuthException, OperationFailed
|
||||
from miniofile import client, put_object
|
||||
|
||||
# 登录, 检查账号, 获取账号配置, 更新账号配置是否隐藏浏览器
|
||||
HEADLESS = False
|
||||
|
||||
|
||||
def sleep(a, b=None):
|
||||
@@ -451,7 +449,7 @@ def playwright_get_user_profile(cookies, username=None):
|
||||
with sync_playwright() as playwright:
|
||||
update_windows_distinguish()
|
||||
browser = playwright.chromium.launch(
|
||||
headless=HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
)
|
||||
context = browser.new_context(no_viewport=True)
|
||||
context.add_cookies(parse_cookies(cookies))
|
||||
@@ -502,7 +500,7 @@ def playwright_set_user_profile(cookies, username=None, first_name=None, last_na
|
||||
with sync_playwright() as playwright:
|
||||
update_windows_distinguish()
|
||||
browser = playwright.chromium.launch(
|
||||
headless=HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
)
|
||||
context = browser.new_context(no_viewport=True)
|
||||
context.add_cookies(parse_cookies(cookies))
|
||||
@@ -558,7 +556,7 @@ def playwright_check_account_cookies(cookies):
|
||||
with sync_playwright() as playwright:
|
||||
update_windows_distinguish()
|
||||
browser = playwright.chromium.launch(
|
||||
headless=HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
)
|
||||
context = browser.new_context(no_viewport=True)
|
||||
context.add_cookies(parse_cookies(cookies))
|
||||
@@ -632,7 +630,7 @@ def playwright_login(username, password, code_2fa=None):
|
||||
with sync_playwright() as playwright:
|
||||
update_windows_distinguish()
|
||||
browser = playwright.chromium.launch(
|
||||
headless=HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
)
|
||||
random_user_agent = UserAgent().getBrowser("Chrome").get("useragent")
|
||||
logger.info(f"使用ua={random_user_agent}")
|
||||
@@ -746,7 +744,7 @@ def playwright_m_login(username, password, code_2fa=None):
|
||||
with sync_playwright() as playwright:
|
||||
update_windows_distinguish()
|
||||
browser = playwright.chromium.launch(
|
||||
headless=HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
headless=const.HEADLESS, args=['--start-maximized'], executable_path=path
|
||||
)
|
||||
# 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"
|
||||
|
||||
Reference in New Issue
Block a user