API
Many requests produce JSON output if you add ?_format=json
to the request.
The JSON should roughly comprise the same data as the HTML render.
Endpoints starting with /api/
are special:
- They only output JSON, i.e. they have no HTML render.
-
They require the user agent to
accept compression.
For example,
curl --compressed
.- It's likely Cloudflare will pass this check for you, but it's still recommended to reduce your bandwidth usage.
There are rate limits on all site access, with nothing special about the API endpoints. If your program uses blocking requests (i.e. never has more than one in flight at a time), you'll never hit this limit.
Endpoints
/api/replays
- Params:
before
(default:1732170850
, i.e., latest replay in database)- Returns: replays ordered by
battle_at
descending wherebattle_at <= before
andbattle_at > before - 700
- Returns: replays ordered by
In other words, each request responds with 700 seconds worth of replays, starting at before
.
If you make 1 request per second, decrementing before
by 700 for each request, you can get all of 1 month's replays in about 1 hour.
Each response has around 5,000 replays, but this can vary a lot depending on how many people were playing at the time.
Note that p1_name
and p2_name
are their current names,
rather than the names they may have been using when the game was played.