From f20ce5b048df35ddc208485d1f7708b15ac9e49a Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 16 Oct 2025 12:30:09 -0700 Subject: add hard limit option on polaris chord news scrape --- bemani/polaris_chord.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bemani') diff --git a/bemani/polaris_chord.py b/bemani/polaris_chord.py index b4c96cd..9bfb57e 100644 --- a/bemani/polaris_chord.py +++ b/bemani/polaris_chord.py @@ -11,12 +11,16 @@ CATEGORY_MAP = { "i_04": "OTHER" } -def parse_polaris_chord_news_site(html: str) -> list[dict]: +def parse_polaris_chord_news_site(html: str, limit: int) -> list[dict]: base_url = "https://eacache.s.konaminet.jp/game/polarischord/pc/" soup = BeautifulSoup(html, 'html.parser') news_list = [] for li in soup.select('li.news'): + # Check if we've reached the limit + if len(news_list) >= limit: + break + raw_type = li.get('data-category') post_type = CATEGORY_MAP.get(raw_type, "OTHER") -- cgit v1.2.3