aboutsummaryrefslogtreecommitdiffstats
path: root/bemani/polaris_chord.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-16 12:30:09 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-16 12:30:09 -0700
commitf20ce5b048df35ddc208485d1f7708b15ac9e49a (patch)
treebb42ecc4bd5bacd85f0f690a8cf5939739847a26 /bemani/polaris_chord.py
parent3222b1622cadc82e69553844c02e2d17c57311d3 (diff)
add hard limit option on polaris chord news scrape
Diffstat (limited to 'bemani/polaris_chord.py')
-rw-r--r--bemani/polaris_chord.py6
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")
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage