How to download the JSON files used to store replays on CG?


#1

Recent post by Agade posted on CG blog talks about downloading JSON files used to store replays on CG. Although there are some posts on how to do that, they are old and I couldn't find any source of the new API. Does anyone know how to get one's own replays?


#2

You linked to a post by reCurse, not Agade.


#3

I have a personal tool to download all my replays in the "last battles" tab and i use it to compile some statistics on my game (i mostly use it to track my timeouts, but i also used it to evaluate the accuracy of the ennemy detection in the fog on Wondev Woman).

You have to use 2 API to do that:

  • POST https://www.codingame.com/services/gamesPlayersRankingRemoteService/findLastBattlesAndProgressByAgentId. Body: [agentId, null]
  • POST https://www.codingame.com/services/gameResultRemoteService/findByGameId. Body: [gameId, null].

The first one is to get the id of all your games in the last battles tab. You have to know your agentId for that. Use http://cgstats.magusgeek.com/ and you'll have it :stuck_out_tongue:

The second one will give you the JSON you are looking for.


#4

This is very helpful. In the past, you (or others) have hesitated sharing this for the fear that if too many use it, it would put too much of a load on CG's servers. Do you have any advise or best practices to avoid this?


#5

The problem is that if a tool like this become more common, Codingame will do the same as with CGSpunk : They'll put a limit on it and it will become just a useless tool ... CGSpunk is "fine", but i need to let it run all the night if i want some real statistic (and even with a complete night i'm very far from really usable statistics ...).

So i don't have any advice on it except that this one : don't publish it anywhere :smiley:


#6

It would be nice if Codingame provides a page with summary (how many win/lost/draw, timeout, bad moves...).