From 686883a39c7fcc99fb376e315cd83d9ede9d7173 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 16 Oct 2025 12:15:16 -0700 Subject: migrate chunithm_intl to use api routes allows for older news to also be added in page view --- news_feed.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'news_feed.py') diff --git a/news_feed.py b/news_feed.py index 2761f29..05378ca 100644 --- a/news_feed.py +++ b/news_feed.py @@ -131,15 +131,16 @@ def get_news(news_url: str, version=None) -> list: elif news_url == constants.CHUNITHM_INTL_NEWS_SITE: site_data = download_site_as_html(news_url) - if version in [constants.CHUNITHM_VERSION.LUMINOUS_PLUS, constants.CHUNITHM_VERSION.VERSE]: - news_posts = sorted(chuni_intl.parse_chuni_intl_news_site(site_data), key=lambda x: x['timestamp'], reverse=True) - if constants.CHUNI_RECURSIVE_IMAGE: - for i in range(len(news_posts)): - if not news_posts[i]["url"]: - continue - post_site_data = download_site_as_html(news_posts[i]["url"]) - post_images = chuni_intl.parse_chuni_intl_post_images(post_site_data) - news_posts[i]["images"].extend([image for image in post_images if not any(existing_image['image'] == image['image'] for existing_image in news_posts[i]["images"])]) + news_posts = sorted(chuni_intl.parse_chuni_intl_api_route(site_data, "CHUNITHM_INTL", constants.CHUNITHM_INTL_RECENT_NEWS_LIMIT), key=lambda x: x['timestamp'], reverse=True) + print(news_posts) + exit() + if constants.CHUNI_RECURSIVE_IMAGE: + for i in range(len(news_posts)): + if not news_posts[i]["url"]: + continue + post_site_data = download_site_as_html(news_posts[i]["url"]) + post_images = chuni_intl.parse_chuni_intl_post_images(post_site_data) + news_posts[i]["images"].extend([image for image in post_images if not any(existing_image['image'] == image['image'] for existing_image in news_posts[i]["images"])]) elif news_url == constants.MAIMAIDX_JP_NEWS_SITE: @@ -150,7 +151,7 @@ def get_news(news_url: str, version=None) -> list: elif news_url == constants.MAIMAIDX_INTL_NEWS_SITE: site_data = download_site_as_html(news_url) - news_posts = sorted(maimaidx_intl.parse_maimaidx_intl_api_route(site_data, "MAIMAIDX_INTL"), key=lambda x: x['timestamp'], reverse=True) + news_posts = sorted(maimaidx_intl.parse_maimaidx_intl_api_route(site_data, "MAIMAIDX_INTL", constants.MAIMAIDX_INTL_RECENT_NEWS_LIMIT), key=lambda x: x['timestamp'], reverse=True) _attach_llm_summaries(news_posts, "maimai DX International") elif news_url == constants.ONGEKI_JP_NEWS_SITE: -- cgit v1.2.3