thesadru / genshinstats

PLEASE USE GENSHIN.PY A python library that can get the stats of Genshin Impact players using Mihoyo's API. PLEASE USE GENSHIN.PY
https://thesadru.github.io/pdoc/genshinstats/
MIT License
265 stars 38 forks source link

Chinese API need to be updated #39

Open molehzy opened 2 years ago

molehzy commented 2 years ago

CreateDynamicSecret V2 https://github.com/Azure99/GenshinPlayerQuery/issues/20#issuecomment-913179474 API Path Change https://github.com/Azure99/GenshinPlayerQuery/issues/20#issuecomment-913167967

thesadru commented 2 years ago

Ah right, I changed it in genshin.py but not in genshinstats. If you want to use the Chinese API immediately I recommend trying out genshin.py

molehzy commented 2 years ago

OK

molehzy commented 2 years ago

The latest "commit" did not modify CN_DS_SALT

thesadru commented 2 years ago

Oops

molehzy commented 2 years ago

And, all endpoint are also did not modify

thesadru commented 2 years ago

I'm a bit confused, the link you sent says https://api-takumi.mihoyo.com/game_record/genshin/api is used. In genshin.py I use https://api-takumi.mihoyo.com/game_record/app/genshin/api however so I thought that maybe I was wrong in genshin.py

Does that mean https://api-takumi.mihoyo.com/game_record/app/genshin/api is correct?

molehzy commented 2 years ago

Yes, the new root path is https://api-takumi.mihoyo.com/game_record/app/*

thesadru commented 2 years ago

I think a rewrite will be required to enable this endpoint. This might take a while.

molehzy commented 2 years ago

The SignIn API use different DS algorithms, headers need x-rpc-device_id value is GUID, here are examples but C# https://github.com/DGP-Studio/Snap.Genshin/blob/main/DGP.Genshin/Services/DailySignInService.cs

thesadru commented 2 years ago

Damn that's a lot to dig through

molehzy commented 2 years ago

I'm going to sleep, 00:40AM (GMT+8) now

molehzy commented 2 years ago

Activity API response data, CN and OS are different. Need to improve the "prettypackage".

molehzy commented 2 years ago

CN character icon url is https://upload-bbs.mihoyo.com/game_record/genshin/character_icon/*.png

thesadru commented 2 years ago

Activity API response data, CN and OS are different.

I have managed to generalize this in genshin.py so I will attempt to port this to genshinstats too.

thesadru commented 2 years ago

Would you mind providing me with any Chinese uid which has completed activities?

molehzy commented 2 years ago

MyUID 100190701

It works but can't check in

thesadru commented 2 years ago

I don't really understand the specifics of claiming daily rewards yet, that implemtation is gonna take a while since I cannot test it at all.

molehzy commented 2 years ago

Use DynamicSecret V1 also "OS DS Generator", salt=4a8knnbk5pbjqsrudp3dq484m9axoc5g

Headers

Body like this

{"act_id":"e202009291139501","uid":"100190701","region":"cn_gf01"}

From https://github.com/DGP-Studio/Snap.Genshin The code is being adjusted over there, I can't find specific

thesadru commented 2 years ago

Sorry but I think this might be outside the scope of this project. It is incredibly hard to maintain support for two various versions of the API and even this simple function would destroy the project structure completely. I would need to switch to using classes or some similar approach.

molehzy commented 2 years ago

genshin.py may need to be modified as well

thesadru commented 2 years ago

Yes, I realize that but the fact I cannot actually test any of the endpoints myself makes this incredibly hard. It will be implemented eventually at some point but I cannot guarantee anything.

molehzy commented 2 years ago

Do you need a chinese account ?

thesadru commented 2 years ago

I could use one but I'm unable to create a qq account outside of china.

molehzy commented 2 years ago

Why do you need QQ ?

thesadru commented 2 years ago

Wait I don't need one?

molehzy commented 2 years ago

Register mihoyo account need ChinesePhoneNumber now, but accounts registered a few years ago can be used directly. QQ is just an IM software

thesadru commented 2 years ago

I see. Even then I still don't have a valid Chinese phone number and all the free phone numbers I try online are not registerable (getting 手机号已被注册)

molehzy commented 2 years ago

I have an account that was registered a few years ago, and it does not require verification of the mobile number, if you need

thesadru commented 2 years ago

That'd be great!

thesadru commented 2 years ago

You can contact me on discord or send me an email if you want to send anything directly to me

molehzy commented 2 years ago

You can contact me on discord or send me an email (***) if you want to send anything directly to me

OK. delete address, I will use *** to send

thesadru commented 2 years ago

It's a success! I'll debug the endpoint now.

molehzy commented 2 years ago

Good luck !

molehzy commented 2 years ago

Is the daily reward implemented here, I see related commit in genshin.py

thesadru commented 2 years ago

I might have to just add a completely separate function for Chinese daily reward claiming at this point. I swear I'll try to implement it at some point but this project is just not made to handle such a large difference.

molehzy commented 2 years ago

https://github.com/thesadru/genshin.py/issues/8