From 8a78d40c158b654d2170d724e15a30990792005e Mon Sep 17 00:00:00 2001 From: projectdx Date: Fri, 13 Jan 2023 21:57:59 +0900 Subject: [PATCH] ohli24 api update 2023.01.13(01.) --- logic_ohli24.py | 90 +++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/logic_ohli24.py b/logic_ohli24.py index aa46b35..56c5d91 100644 --- a/logic_ohli24.py +++ b/logic_ohli24.py @@ -121,43 +121,59 @@ class LogicOhli24(LogicModuleBase): import time cookie = None + # 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", + # ] browser_args = [ "--window-size=1300,570", - "--window-position=000,000", - "--disable-dev-shm-usage", + "--window-position=0,0", + # "--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-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", + # "--use-gl=egl", "--mute-audio", ] # scraper = cloudscraper.create_scraper( @@ -223,7 +239,7 @@ class LogicOhli24(LogicModuleBase): # LogicAniLife.headers["Cookie"] = cookie_value - await context.set_extra_http_headers(LogicOhli24.headers) + # await context.set_extra_http_headers(LogicOhli24.headers) page = await context.new_page() @@ -246,12 +262,12 @@ class LogicOhli24(LogicModuleBase): # networkidle await page.goto( url, - wait_until="networkidle", + wait_until="load", referer=LogicOhli24.headers["Referer"], ) # page.wait_for_timeout(10000) # await asyncio.sleep(2.9) - await asyncio.sleep(6) + await asyncio.sleep(1) # await page.reload() @@ -950,7 +966,7 @@ class LogicOhli24(LogicModuleBase): response_data = asyncio.run( LogicOhli24.get_html_playwright( url, - headless=False, + headless=True, # referer=referer_url, engine="chrome", # stealth=stealth,