diff --git a/backend/tft/cli.py b/backend/tft/cli.py index 5e08ad1..4349877 100644 --- a/backend/tft/cli.py +++ b/backend/tft/cli.py @@ -18,8 +18,7 @@ def main() -> None: p_fetch = sub.add_parser("fetch-static", help="download static data from Community Dragon") p_fetch.add_argument("--set", type=int, default=None, help="override set number") - p_crawl = sub.add_parser("crawl", help="crawl ranked matches from Challenger/GM ladder") - p_crawl.add_argument("--limit", type=int, default=None, help="stop after N new matches") + sub.add_parser("crawl", help="crawl ranked matches from Challenger/GM ladder (max 200 neue pro Lauf)") sub.add_parser("extract", help="extract endboards from raw matches") sub.add_parser("build-artifact", help="build analysis.json from static data + endboards") @@ -45,7 +44,7 @@ def main() -> None: elif args.command == "crawl": from tft.matches.crawl import crawl - added = crawl(set_number=current_set(), limit=args.limit) + added = crawl(set_number=current_set()) print(f"{added} new matches stored") elif args.command == "extract": diff --git a/backend/tft/matches/crawl.py b/backend/tft/matches/crawl.py index 1a47f42..40454c4 100644 --- a/backend/tft/matches/crawl.py +++ b/backend/tft/matches/crawl.py @@ -9,7 +9,7 @@ from tft.matches.riot import RiotClient RANKED_QUEUE = 1100 -def crawl(set_number: int, limit: int | None = None) -> int: +def crawl(set_number: int, limit: int = 200) -> int: client = RiotClient() conn = db.connect() seen = {row[0] for row in conn.execute("SELECT match_id FROM matches")} @@ -19,13 +19,13 @@ def crawl(set_number: int, limit: int | None = None) -> int: print(f"ladder: {len(entries)} players") for entry in entries: - if limit is not None and added >= limit: + if added >= limit: break puuid = client.puuid_for_entry(entry) for match_id in client.match_ids(puuid): if match_id in seen: continue - if limit is not None and added >= limit: + if added >= limit: break match = client.match(match_id) info = match["info"]