This is an unofficial, uncomplete and (pretty sure) wrong documentation of the RESTful service which powers the League of Legends spectator mode.
This documentation is desgined to be community driven and should be extended by everyone. If you find things missing, add them please!
Riot's spectator mode works by requesting replay data via HTTP form a service. The data is split in chunks which usually contain about 30 seconds of gameplay. Additionally there are key frames which seem to contain more information then a single chunk. They seem to be used to support skipping back in time or for spectators that join the game later. This means that the key frames should contain every information about the state of a game at a given point in time. On the other hand, chunks may only contain changes to this state.
This leads to the following process for replaying a series of chunks:
- Read key frame thats prior to the targeted point in time
- Read chunk following this key frame
- apply the changes described in the chunk
- read next chunk
- repeat 3 + 4 until end of game or skip
The same procedure is known to work in many video and audio formats. It provides a fast and bandwidth saving way of deliviering all information fast while it also gives a good way to jump quickly to any point in time without the need to replay every chunk from the start to that moment.
Chunks and Keyframes are encrypted and compressed. The algorithm used for cryptography seems to be Blowfish in ECB mode. Compression is done using zip BEFORE the encryption. So to read a chunks data one needs to first decrypt then uncompress the data.
Most of the REST URLs look like this:
http://<REST host:port>/observer-mode/rest/consumer/<method>/<platformId>/<gameID>/<parameter>/token'
Parameters
- host:port: there are currently 8 REST services running for the different regions. A list of these servers exists at the end of this document.
- method: Name of the method you want to call. See "Methods".
- platformId/gameID: Every game is uniquely identified by the short name of its region and a numeric game ID.
- parameter: The methods first and single parameter (aside of gameid/platformId). If a method doesn't require an additional parameter this value is '1'
URL .../featured
Lists the 10 featured games for the regions supported by this server.
URL: .../version
Contains the current version for this Region.
URL: .../consumer/getGameMetaData/<platformId>/<gameID>/1/token
Returns information about the given game. This contains the games type and map, summoners involved, champions picked & banned, start time of the game and the encryption key required to read the replay data.
URL: .../consumer/getLastChunkInfo/<platformId>/<gameID>/1/token
Return some information about the last avaiable chunk:
- chunkId: ID of the last available chunk,
- availableSince: Number of ms this chunk is available (?),
- nextAvailableChunk: Number of ms until the next chunk is available (?),
- keyFrameId: key frame that belongs to this chunk,
- nextChunkId: chunk that directly follows this key frame,
- endStartupChunkId: chunk that determinates the end of pick&ban phase,
- startGameChunkId: fist chunk of the actual game,
- endGameChunkId: last chunk of the actual game (or 0 if game still running),
- duration: Number of ms this chunks information represents
URL: .../consumer/getLastChunkInfo/<platformId>/<gameID>/null (!)
Contains data used for the statistics screen after a game.
Example Content: http://pastebin.com/KB4TUPhs (thanks to Divi)
URL: .../consumer/getGameDataChunk/<platformId>/<gameID>/<chunkId>/token
Retrieves a chunk of data for the given game.
URL: .../consumer/getKeyFrame/<platformId>/<gameID>/<keyFrameId>/token
Retrieves a key frame for the given game.
- NA
- EUW1
- EUN1
- NA: spectator.na.lol.riotgames.com:8088
- EUW: spectator.eu.lol.riotgames.com:8088
- EUNE: spectator.eu.lol.riotgames.com:8088
- BR: spectator.br.lol.riotgames.com:80
- LAN: spectator.br.lol.riotgames.com:80
- RUS: spectator.tr.lol.riotgames.com:80
- TUR: spectator.tr.lol.riotgames.com:80
- PBE: spectator.pbe1.lol.riotgames.com:8088
- SK: QFKR1PROXY.kassad.in:8088
- TW: QFTW1PROXY.kassad.in:8088
- SEA: qfsea1proxy.kassad.in:8088