From cf5ec2e07331fb3876641903175b1a1fea41e67a Mon Sep 17 00:00:00 2001 From: projectdx Date: Sun, 23 Oct 2022 23:01:19 +0900 Subject: [PATCH] anilife update 2022.10.23(01.) --- logic_anilife.py | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/logic_anilife.py b/logic_anilife.py index 7b636ee..b4c579c 100644 --- a/logic_anilife.py +++ b/logic_anilife.py @@ -180,6 +180,45 @@ class LogicAniLife(LogicModuleBase): import time + browser_args = [ + '--window-size=1300,570', + '--window-position=000,000', + '--disable-dev-shm-usage', + '--no-sandbox', + '--disable-web-security', + '--disable-features=site-per-process', + '--disable-setuid-sandbox', + '--disable-accelerated-2d-canvas', + '--no-first-run', + '--no-zygote', + # '--single-process', + '--disable-gpu', + '--use-gl=egl', + '--disable-blink-features=AutomationControlled', + '--disable-background-networking', + '--enable-features=NetworkService,NetworkServiceInProcess', + '--disable-background-timer-throttling', + '--disable-backgrounding-occluded-windows', + '--disable-breakpad', + '--disable-client-side-phishing-detection', + '--disable-component-extensions-with-background-pages', + '--disable-default-apps', + '--disable-extensions', + '--disable-features=Translate', + '--disable-hang-monitor', + '--disable-ipc-flooding-protection', + '--disable-popup-blocking', + '--disable-prompt-on-repost', + '--disable-renderer-backgrounding', + '--disable-sync', + '--force-color-profile=srgb', + '--metrics-recording-only', + '--enable-automation', + '--password-store=basic', + '--use-mock-keychain', + '--hide-scrollbars', + '--mute-audio' + ] # scraper = cloudscraper.create_scraper( # browser={"browser": "chrome", "platform": "windows", "desktop": True}, # debug=False, @@ -207,11 +246,11 @@ class LogicAniLife(LogicModuleBase): async with async_playwright() as p: if engine == "chrome": - browser = await p.chromium.launch(channel="chrome", headless=headless) + browser = await p.chromium.launch(channel="chrome", args=browser_args, headless=headless) elif engine == "webkit": - browser = await p.webkit.launch(headless=headless) + browser = await p.webkit.launch(headless=headless, args=browser_args,) else: - browser = await p.firefox.launch(headless=headless) + browser = await p.firefox.launch(headless=headless, args=browser_args,) # context = browser.new_context( # user_agent=ua, # ) @@ -1111,7 +1150,7 @@ class AniLifeQueueEntity(FfmpegQueueEntity): text = asyncio.run( LogicAniLife.get_html_playwright( url, - headless=False, + headless=True, referer=referer_url, engine="chrome", stealth=True,