From 548902e095eca82704d55a54ff69d5deda86ce14 Mon Sep 17 00:00:00 2001 From: projectdx Date: Tue, 31 Jan 2023 17:21:38 +0900 Subject: [PATCH] =?UTF-8?q?2022.01.31=20anilife=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=ED=94=BD=EC=8A=A4=20(.01)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic_anilife.py | 112 +- .../anime_downloader_anilife_category.html | 1524 +++++++++-------- templates/anime_downloader_anilife_list.html | 303 ++-- 3 files changed, 1025 insertions(+), 914 deletions(-) diff --git a/logic_anilife.py b/logic_anilife.py index 0ca79b3..34561ba 100644 --- a/logic_anilife.py +++ b/logic_anilife.py @@ -178,43 +178,59 @@ class LogicAniLife(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( @@ -302,7 +318,8 @@ class LogicAniLife(LogicModuleBase): url, wait_until="load", referer=LogicAniLife.headers["Referer"] ) # page.wait_for_timeout(10000) - await asyncio.sleep(2.9) + # await asyncio.sleep(2.9) + await asyncio.sleep(1) # await page.reload() @@ -313,11 +330,13 @@ class LogicAniLife(LogicModuleBase): print(f"page.url:: {page.url}") LogicAniLife.origin_url = page.url - # print(page.content()) + temp_content = await page.content() + # + # print(temp_content) print(f"run at {time.time() - start} sec") - return await page.content() + return temp_content except Exception as e: logger.error("Exception:%s", e) logger.error(traceback.format_exc()) @@ -922,8 +941,25 @@ class LogicAniLife(LogicModuleBase): return jsonify(ModelAniLifeItem.web_list(request)) elif sub == "db_remove": return jsonify(ModelAniLifeItem.delete_by_id(req.form["id"])) + elif sub == "add_whitelist": + try: + # params = request.get_data() + # logger.debug(f"params: {params}") + # data_code = request.args.get("data_code") + params = request.get_json() + logger.debug(f"params:: {params}") + if params is not None: + code = params["data_code"] + logger.debug(f"params: {code}") + ret = LogicOhli24.add_whitelist(code) + else: + ret = LogicOhli24.add_whitelist() + return jsonify(ret) + except Exception as e: + logger.error("Exception:%s", e) + logger.error(traceback.format_exc()) except Exception as e: - P.logger.error("Exception:%s", e) + P.logger.error(f"Exception: {str(e)}") P.logger.error(traceback.format_exc()) @staticmethod @@ -1268,7 +1304,7 @@ class AniLifeQueueEntity(FfmpegQueueEntity): db_entity = ModelAniLifeItem.get_by_anilife_id(self.info["_id"]) if db_entity is not None: db_entity.status = "completed" - db_entity.complated_time = datetime.now() + db_entity.completed_time = datetime.now() db_entity.save() def make_episode_info(self): diff --git a/templates/anime_downloader_anilife_category.html b/templates/anime_downloader_anilife_category.html index 23f42b4..3c073f6 100644 --- a/templates/anime_downloader_anilife_category.html +++ b/templates/anime_downloader_anilife_category.html @@ -1,808 +1,850 @@ {% extends "base.html" %} {% block content %}
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
- - + +
-
- - - - -
-
-
-
-
-
-
-
-
-
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ - + {% endblock %} diff --git a/templates/anime_downloader_anilife_list.html b/templates/anime_downloader_anilife_list.html index 6414ac7..9a3cb18 100644 --- a/templates/anime_downloader_anilife_list.html +++ b/templates/anime_downloader_anilife_list.html @@ -1,10 +1,10 @@ {% extends "base.html" %} {% block content %} - +
- + +
+ {{ macros.m_hr_head_top() }} + {{ macros.m_row_start('0') }} + {{ macros.m_col(2, macros.m_strong('Poster')) }} + {{ macros.m_col(10, macros.m_strong('Info')) }} + {{ macros.m_row_end() }} + {{ macros.m_hr_head_bottom() }} +
+
{% endblock %} \ No newline at end of file