- Get link
- X
- Other Apps
Well, it seems like OpenDota has provided us some clue:
Since OpenDota is open source, I spend some time digging out how to download dota 2 replay. It turns out that, there is no rest api open for this purpose: we have to download via valve, instead of dota 2.
So, let's get started.
The API open for OpenDota to get the replay data looks like this:
https://api.opendota.com/api/replays?match_id={your_match_id}if you replace {your_match_id} with a valid dota 2 match id, for example:
https://api.opendota.com/api/replays?match_id=4179886867You will probably get something like this:
[{"match_id":4179886867,"cluster":152,"replay_salt":1820235712,"series_id":0,"series_type":0}]If you supply a very old match_id, and it is expired, then you will get an empty json array.
Ok, what happened next? This doesn't give you a video right?
The most exciting part, come next, you need to go to the following url:
replay{cluster}.valve.net/570/{match_id}_{replay_salt}.dem.bz2Which in this case:
replay152.valve.net/570/4179886867_1820235712.dem.bz2Then you will get a *.dem.bz2 file, which is a dota 2 replay file. You have thus achieve your purpose, congratulations!
Do note that, it is not in any video format extension format, this is because this replay contains much more information then what a video could have. It contains the net worth for every hero in every second, the perspective of every hero etc.
How to parse the video then? I will look more about it and reveal what I found in next post.
Thank you for reading this post, I will recommend dota2 theme song in this post:
Thank you. Feel free to buy me a coffee if you like this post.
pharaoh
21/10/2018
11:51p.m.

Comments
Post a Comment