From f342dca5bd5e239362768ec80ca478ee3cee608b Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 19 May 2025 16:22:40 -0700 Subject: wmmt: fix response encoding, remove internal_path requirements --- bandai_namco/wmmt.py | 8 ++++---- news_feed.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bandai_namco/wmmt.py b/bandai_namco/wmmt.py index c70440e..1277514 100644 --- a/bandai_namco/wmmt.py +++ b/bandai_namco/wmmt.py @@ -131,7 +131,7 @@ def make_wmmt_parser(version: constants.WANGAN_MAXI_VERSION): return six_rr_plus_parser -def make_wmmt_news_extractor(identifier: str, version: constants.WANGAN_MAXI_VERSION, internal_path: str, region_text: str): +def make_wmmt_news_extractor(identifier: str, version: constants.WANGAN_MAXI_VERSION, region_text: str): def five_dx_plus_extractor(html: str, data: dict): soup = BeautifulSoup(html, "html.parser") container = soup.select_one(".parts_inner_01") @@ -245,6 +245,6 @@ def make_wmmt_news_extractor(identifier: str, version: constants.WANGAN_MAXI_VER get_wmmt_na_news_post_links = make_wmmt_parser(constants.WANGAN_MAXI_VERSION.FIVE_DX_PLUS) get_wmmt_asia_oce_news_post_links = make_wmmt_parser(constants.WANGAN_MAXI_VERSION.SIX_RR) get_wmmt_jp_news_post_links = make_wmmt_parser(constants.WANGAN_MAXI_VERSION.SIX_RR_PLUS) -parse_wmmt_na_news = make_wmmt_news_extractor("WANGAN_MAXI_NA", constants.WANGAN_MAXI_VERSION.FIVE_DX_PLUS, "wanganmaxi5dxplus/na", "NA") -parse_wmmt_asia_oce_news = make_wmmt_news_extractor("WANGAN_MAXI_ASIA_OCE", constants.WANGAN_MAXI_VERSION.SIX_RR, "wanganmaxi6rr/en", "ASIA/OCE") -parse_wmmt_jp_news = make_wmmt_news_extractor("WANGAN_MAXI_JP", constants.WANGAN_MAXI_VERSION.SIX_RR_PLUS, "wanganmaxi6rrplus/jp", "JPN") +parse_wmmt_na_news = make_wmmt_news_extractor("WANGAN_MAXI_NA", constants.WANGAN_MAXI_VERSION.FIVE_DX_PLUS, "NA") +parse_wmmt_asia_oce_news = make_wmmt_news_extractor("WANGAN_MAXI_ASIA_OCE", constants.WANGAN_MAXI_VERSION.SIX_RR, "ASIA/OCE") +parse_wmmt_jp_news = make_wmmt_news_extractor("WANGAN_MAXI_JP", constants.WANGAN_MAXI_VERSION.SIX_RR_PLUS, "JPN") diff --git a/news_feed.py b/news_feed.py index e6e125e..fb11c6c 100644 --- a/news_feed.py +++ b/news_feed.py @@ -169,14 +169,14 @@ def get_news(news_url: str, version=None) -> list: elif news_url == constants.WANGAN_MAXI_GENERIC: news_posts = [] - na_site_data = download_site_as_html(constants.WANGAN_MAXI_NA_NEWS_SITE) + na_site_data = download_site_as_html(constants.WANGAN_MAXI_NA_NEWS_SITE, response_encoding="utf-8") prelim_na_news_data = wmmt.get_wmmt_na_news_post_links(na_site_data) for data in prelim_na_news_data: post_site_data = download_site_as_html(data["url"]) news = wmmt.parse_wmmt_na_news(post_site_data, data) if news is not None: news_posts.append(news) - asia_oce_site_data = download_site_as_html(constants.WANGAN_MAXI_ASIA_OCE_NEWS_SITE) + asia_oce_site_data = download_site_as_html(constants.WANGAN_MAXI_ASIA_OCE_NEWS_SITE, response_encoding="utf-8") prelim_asia_oce_news_data = wmmt.get_wmmt_asia_oce_news_post_links(asia_oce_site_data) for data in prelim_asia_oce_news_data: post_site_data = download_site_as_html(data["url"]) -- cgit v1.2.3