billy-yoyo / RainbowSixSiege-Python-API

Asynchronous python api for rainbow six siege (r6sapi)
MIT License
130 stars 31 forks source link

Reimplement definition hashes for operator, rank, loadout and seasons #68

Closed Jackywathy closed 3 years ago

Jackywathy commented 3 years ago

There's a chunk of code dedicated to getting definition hashes that relies on a website called r6unhash.tk https://github.com/billy-yoyo/RainbowSixSiege-Python-API/blob/32da4403cfd529a39c41f21fe4e71443c4b4a487/r6sapi/auth.py#L399. This service seems to have gone down, and now get operator / rank hangs for ages or errors out. Need a bit of help understanding what is going on there and how we can replace it to get the library working again.

Jackywathy commented 3 years ago

a bit of digging later, seems like they're using graphQL to store the operator and querying it via client side javascript. I've managed to extract a raw json file containing the information - search for an operator name like maverick in the source and one of the results is giant blob of javascript which the json file is contained in.

json2.txt

Danampasis commented 3 years ago

Hey, can you please explain the steps you took to extract the .json file? Maybe we can find the other .json files like that too, for the rewards, seasons, and ranks

Jackywathy commented 3 years ago

i went on the ubisoft stat tracking website (https://www.ubisoft.com/en-us/game/rainbow-six/siege/stats), then searched the html for operator. There was an inline script function starting with window__PRELOADED_STATE__ = blah which was the json (well technically javascipt object) with all the information. I've been able extract rank, operator + loadout and maps definitions. I've attached them below, but maybe you can make sense of the other fields that I have missed. There's also some variables that change per-account, so see if you get anything different.

From now on i think we should rely on our own definitions rather than using the r6hash.tk website which seems to have gone down - I think the owner of that domain forgot/don't want to re-register it. So far I've been working on operator and loadout definitions, which (fingers crossed) will be completed by tonight or tomorrow.

operators.txt maps.txt ranks.txt

Jackywathy commented 3 years ago

WIP here, have gotten get_operator to work with a new definitions system https://github.com/Jackywathy/RainbowSixSiege-Python-API/tree/bugfix/definition-hashes

Jackywathy commented 3 years ago

Fixed most of the definitions issues here https://github.com/Jackywathy/RainbowSixSiege-Python-API/tree/bugfix/definition-hashes. All basic functions like kills, deaths etc as well as operator unique abilities are supported (minus aruni's gate stats). Going to clean it up a little before I send a pull request.

Jackywathy commented 3 years ago

See https://github.com/Jackywathy/RainbowSixSiege-Python-API/commit/d9ca7265b08a18bfe0136c6b664f3bcf242306f8