liufuhua007
......@@ -13,7 +13,7 @@ from utils.log import sohu_logger
async def cookie_auth(account_file):
async with async_playwright() as playwright:
browser = await playwright.chromium.launch(headless=False)
browser = await playwright.chromium.launch(headless=True)
context = await browser.new_context(storage_state=account_file)
await set_init_script(context)
# context = await browser.new_context()
......@@ -49,7 +49,7 @@ async def get_sohu_cookie(account_file):
'args': [
'--lang en-GB'
],
'headless': False, # Set headless option here
'headless': True, # Set headless option here
}
# Make sure to run headed.
browser = await playwright.chromium.launch(**options)
......@@ -98,7 +98,7 @@ class SOHUVideo(object):
)
else:
browser = await playwright.chromium.launch(
headless=False
headless=True
) # 创建一个浏览器上下文,使用指定的 cookie 文件
context = await browser.new_context(storage_state=self.account_file)
page = await context.new_page()
......