diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-10-16 12:30:09 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-10-16 12:30:09 -0700 |
| commit | f20ce5b048df35ddc208485d1f7708b15ac9e49a (patch) | |
| tree | bb42ecc4bd5bacd85f0f690a8cf5939739847a26 /bemani/polaris_chord.py | |
| parent | 3222b1622cadc82e69553844c02e2d17c57311d3 (diff) | |
add hard limit option on polaris chord news scrape
Diffstat (limited to 'bemani/polaris_chord.py')
| -rw-r--r-- | bemani/polaris_chord.py | 6 |
1 files changed, 5 insertions, 1 deletions
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") |
