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