torikushiii / starrail-auto

Auto check-in and others for Honkai: Star Rail
https://ko-fi.com/torikushiii
GNU Affero General Public License v3.0
105 stars 24 forks source link

API error #44

Open Bestfast opened 4 months ago

Bestfast commented 4 months ago

out of 4 accounts, only one works as of right now. I tried regenerating tokens by logging out and logging in an incognito tab, but I receive the same error: 2024-05-30 12:28:14 [INFO]: { message: 'API error when getting stamina info', args: { statusCode: 200, body: { data: null, message: '', retcode: 10035 } } } any clue will be of great help

Capoouo commented 4 months ago

I have the same issue, but it only happens frequently with one of my four accounts Only that account frequently has this issue, while the other accounts rarely do. I don't know the reason why

torikushiii commented 4 months ago

retcode: 10035 indicates that the account needs to complete a CAPTCHA. Have you encountered any CAPTCHAs while regenerating the account tokens? This issue usually resolves itself after you solve one.

If you haven't encountered any CAPTCHAs while regenerating token, please try to claim check-in manually and see if you get any CAPTCHA

Capoouo commented 4 months ago

I just tried the auto check-in, and the account did check-in, but the stamina check still showed the same error emmm...and when I log into that account, I don't encounter any CAPTCHA

torikushiii commented 4 months ago

I see, thank you for reporting back. I'll try to investigate if this is happening anywhere else.

Bestfast commented 4 months ago

I just tried the auto check-in, and the account did check-in, but the stamina check still showed the same error emmm...and when I log into that account, I don't encounter any CAPTCHA

can confirm this behavior on my side too

Capoouo commented 4 months ago

Let me add some details. I tested the Code Redeem and auto-sign, and they are working. However, every half an hour, the following message appears: message: 'API error when getting stamina info', args: { statusCode: 200, body: { data: null, message: '', retcode: 10035 } } It is indeed a bit annoying LOL

torikushiii commented 4 months ago

Hello, I've updated the code and it should working fine now, please pull/download the new version and follow the new instruction

If you still encounters any problem, feel free to ask.

Bestfast commented 4 months ago

Hello, I've updated the code and it should working fine now, please pull/download the new version and follow the new instruction

If you still encounters any problem, feel free to ask.

Problem persists after pulling the repo and updating the cookies, with only account_mid_v2, cookie_token_v2 and ltuid_v2. If you prefer, we could try to debug it more on discord, with my id being bestfast

Bestfast commented 4 months ago

for more context: login works, stamina retrieval doesn't

torikushiii commented 4 months ago

I'm gonna assume it have the same retcode error which is retcode: 10035?

Bestfast commented 4 months ago

yep

Capoouo commented 4 months ago

It's still the same situation after the replacement 24

torikushiii commented 4 months ago

After looking around, retcode: 10035 is indeed related to captcha, can any of you guys that received this error go to your HoyoLab Battle Chronicle / Battle Records to see if any of you got captchas to solve?

I've tried spamming the end-point and managed to trigger the captcha system image

After solving it, everything runs fine

Capoouo commented 4 months ago

I did not use incognito mode and after repeatedly logging out and logging in with four accounts, everything is currently working fine. Thank you for your help

Bestfast commented 4 months ago

I confirm that spamming works Maybe could be added as a command for telegram/discord, to remind that a captcha must be completed, along a message in the readme?

Bestfast commented 4 months ago

Ok no, nevermind, the issue only fixed for a very small amount of time

torikushiii commented 4 months ago

I forgot to mention that the captcha will come back because your accounts still flagged as high_risk at their endpoint, so you'll need to do few captchas before it will go away completely.

Bestfast commented 4 months ago

I spammed the endpoint for 25 minutes, managed to do 5 captchas in the first 15 minutes and nothing else happened. After 1 hours the issue happened again, but i don't see any captcha anymore. Worth of note, it's running on my machine with the same ip address and everything. I don't know what the issue could be here, maybe it's flagging the client somehow?

torikushiii commented 4 months ago

Are you running multiple accounts? It’s possible that this is triggering the captcha. I can add a few delays to each request to the notes endpoint, but I don’t think it will help because their captcha system is pretty aggressive.

Bestfast commented 4 months ago

Yes I'm currently running 3 accounts, the issue persists after solving the captcha (5 times each account) on every account 0 clue how to proceed, seems strange as it's been working for the past 5? months

torikushiii commented 4 months ago

I noticed that they have started aggressively detecting bots in the past few days too, maybe I can just add a delay on every request to the notes endpoint and see if its help

Capoouo commented 4 months ago

I noticed that they have started aggressively detecting bots in the past few days too, maybe I can just add a delay on every request to the notes endpoint and see if its help

you can give it a try Currently, I am in the same situation as him

torikushiii commented 4 months ago

@Bestfast, can you try this branch and tell me the result? I've tested it with at least three accounts and haven't been flagged.

Do the captcha for at least one or more accounts, then follow this guide again, but only from step 1 through 6.

To get your device_id, go to the getGameRecordCard headers and find this header: image

To get your device fp, go to Application > Cookies > https://www.hoyolab.com > Filter bar > Search for DEVICEFP > and copy whichever value you see: image

Bestfast commented 4 months ago

It's running for now, i'll report back if it's fixed or not soon ™️

Bestfast commented 4 months ago

also I don't know if it's supposed to be like that, but both devicefp and deviceid are the same for every account, i think it's bound to your browser session or something

torikushiii commented 4 months ago

iirc its browser bounded and it should be fine

Bestfast commented 4 months ago

rip it didn't even last 2 hours, doesnt seem like it's working, my account get instantly flagged again

torikushiii commented 4 months ago

Interesting... I'm assuming you're running the cron timers using the default value?

If so, I'll take a look again later this day and figure out what's going on.

Bestfast commented 4 months ago

Yes, I'm using the default value

torikushiii commented 4 months ago

@Bestfast , are you willing to try this hoyolab-auto repo?

This repo is currently in development and has the same functionality, but instead of supporting only Star Rail, it supports all Hoyo games.

Currently, I'm trying to cache the requests and clear the cache every hour. That's the simplest solution I can think of for now. I haven't implemented the function here since it's kind of difficult to integrate it with the current codebase.

However, if you don't encounter any captcha errors while using that repo, I can try to port the code to this repo for those who still use it.

For the accounts that receive captchas, can you solve them and refresh the Battle Records at least two times to ensure you don't get any captcha before running the script? If you do, repeat the step until you don't receive any captcha (don't forget to refresh the page one or two times).

If you have any question feel free to ask on either of the repo.

Capoouo commented 4 months ago

@Bestfast , are you willing to try this hoyolab-auto repo?

This repo is currently in development and has the same functionality, but instead of supporting only Star Rail, it supports all Hoyo games.

Currently, I'm trying to cache the requests and clear the cache every hour. That's the simplest solution I can think of for now. I haven't implemented the function here since it's kind of difficult to integrate it with the current codebase.

However, if you don't encounter any captcha errors while using that repo, I can try to port the code to this repo for those who still use it.

For the accounts that receive captchas, can you solve them and refresh the Battle Records at least two times to ensure you don't get any captcha before running the script? If you do, repeat the step until you don't receive any captcha (don't forget to refresh the page one or two times).

If you have any question feel free to ask on either of the repo.

I might try hoyolab-auto tonight because this issue is really annoying LOL However, I want to ask how the redeem code functionality in hoyolab-auto works From the code I haven't seen anything related to finding new redemption codes, and if it has something similar to code.js in starrail-auto. If it's the first time running, will there be a code.js or a message about redemption?

torikushiii commented 4 months ago

I might try hoyolab-auto tonight because this issue is really annoying LOL However, I want to ask how the redeem code functionality in hoyolab-auto works From the code I haven't seen anything related to finding new redemption codes, and if it has something similar to code.js in starrail-auto. If it's the first time running, will there be a code.js or a message about redemption?

redeem code is currently is under development, and not yet implemented as of now, but the idea is mostly the same of the current one on starrail-auto.

before you tried the hoyolab-auto, remember to do this step before running it

For the accounts that receive captchas, can you solve them and refresh the Battle Records at least two times to ensure you don't get any captcha before running the script? If you do, repeat the step until you don't receive any captcha (don't forget to refresh the page one or two times).

Capoouo commented 4 months ago

Sure, I understand. Looking forward to your implementation of the redeem code (the reason I'm more involved in this project is because of LOL) Thank you for continuously updating your project <3

Bestfast commented 3 months ago

Sure, I understand. Looking forward to your implementation of the redeem code (the reason I'm more involved in this project is because of LOL) Thank you for continuously updating your project <3

Did you try that solution? I have been busy the whole week and didn't have time to

Capoouo commented 3 months ago

Sure, I understand. Looking forward to your implementation of the redeem code (the reason I'm more involved in this project is because of LOL) Thank you for continuously updating your project <3

Did you try that solution? I have been busy the whole week and didn't have time to

I'm currently still using this project. As for the other project, hoyolab-auto, I see that the author is still continuously updating it. I plan to use it once it becomes more stable. For now, I've turned off the stamina reminder to avoid those annoying messages, LOL