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
267 stars 38 forks source link

Implement the current resin count #36

Closed thesadru closed 3 years ago

thesadru commented 3 years ago

There seems to be a project using the Chinese API which has access to the current resin yaomeng0722/genshin_task-resin-expedition_alert

It uses an endpoint that doesn't seem to have an overseas equivalent https://api-takumi.mihoyo.com/game_record/app/genshin/api/dailyNote

Figuring out if there's an overseas version and implementing it could be very beneficial.

scmanjarrez commented 3 years ago

Seems like the global endpoint is https://api-os-takumi.mihoyo.com/game_record/genshin/api/dailyNote I can't make it work from a rest client, but modifying the js did the job. image image image

thesadru commented 3 years ago

Oh my, when I created this issue it hasn't existed yet. Mihoyo is working hard for once. I'll try to look into it now.

thesadru commented 3 years ago

This is a bit curious but for https://api-os-takumi.mihoyo.com/game_record/genshin/api/dailyNote?role_id=710785423&server=os_euro I am getting {'retcode': 10102, 'message': 'Data is not public for the user'}

May I know if you have changed any settings or perhaps where the js you're talking about is from? I doubt getting forbidden from accessing my own data is the intended behavior.

scmanjarrez commented 3 years ago

How did you do the request? I'm using local overrides from chrome, I changed pc_ys_07b794b37daaf745c38b.js file image

thesadru commented 3 years ago

How did you do the request?

I simply sent the request along with valid cookies for my own account and the standard required headers.

scmanjarrez commented 3 years ago

I guess they require another header, idk. I'm triying to recreate the same request my browser did. If you want, I can tell you how to do local overrides using chrome

thesadru commented 3 years ago

Could be useful but I hope something like that is not required.

scmanjarrez commented 3 years ago

Here is a post about local overrides: https://medium.com/globant/local-overrides-a-smart-add-on-to-chrome-fee3f6993ea0

thesadru commented 3 years ago

Alright I might be super stupid here but I would've thought this would've solved it. image

scmanjarrez commented 3 years ago

Did you check the network tab? You should have a GET request to dailyNote?server=os_euro&role_id=xxxxxxxxx. Also, did you created a copy of the file, or edited the original then saved (Ctrl-S | Save as)?

thesadru commented 3 years ago

sure did, no such call showed up.

I downloaded the file and then recreated the directory structure and added the new modified file.

thesadru commented 3 years ago

So I seem to have fixed this but image

thesadru commented 3 years ago

Seems to be related to this? image

scmanjarrez commented 3 years ago

Ohh, that could be. I remember enabling it in the app

thesadru commented 3 years ago

Giving me 404s image

I'll try it from the app and see

scmanjarrez commented 3 years ago

I'm having the same message about error on server side on every switch in chrome and firefox. Try from hoyolab app if you have luck.

thesadru commented 3 years ago

Somehow the app is just not working, changing settings doesn't actually seem to persist at all. I'll see what I can do later.

I'm sure that since everything is already halfway implemented mihoyo plans on releasing it to the public soon.

scmanjarrez commented 3 years ago

I hope so... I tried changing the switches with the app and they're showing on the browser.

thesadru commented 3 years ago

Interesting. I can change the switches fine when I go from settings but there's no setting for enabling daily notes. When I go from the settings inside of the game chronicle it just doesn't persist (the name is even Chinese in that version of the settings)

scmanjarrez commented 3 years ago

I've been testing the api, but abyss and activities endpoints return the same invalid request error...

scmanjarrez commented 3 years ago

Ok, after playing with your code, I managed to make it work: https://gist.github.com/scmanjarrez/78632ca7ab0802ca2df47353b3002627 I wasn't generating the DS parameter for the request and was using the wrong server qparam image

thesadru commented 3 years ago

yeah, I too managed to do it myself, it seems mihoyo fixed their endpoint a few hours ago. Didn't have time to implement it properly yet so I'm taking a while.