vermaysha / hoyoapi

HoYoAPI is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.
https://vermaysha.github.io/hoyoapi/
MIT License
67 stars 14 forks source link

Please add ability to deal with geetest during daily check-in #118

Open jokelbaf opened 1 year ago

jokelbaf commented 1 year ago

There is a chance of triggering geetest (captcha) during daily check-in. Although the retcode is 0 and message is 'ok', gt_result object is returned by the API. It is pretty obvious that the library can't solve captcha but it will be really cool if geetest data was returned by genshin.daily.claim() and there was a way to retry this method with solved (manually) geetest.

Here is an example response of the request sent to DAILY_CLAIM_API (Genshin) endpoint when geetest was triggered:

{
  data: {
    code: 'ok',
    first_bind: false,
    gt_result: {
      risk_code: 5001,
      gt: 'a280f1e34s45a37ae91c65fc745fba71c',
      challenge: 'ef74ab0042086a343ba869f5e29dab6e',
      success: 1,
      is_risk: true
    }
  },
  message: 'OK',
  retcode: 0
}

Note: _Looks like success in gt_result is 0 if API accepted solved geetest._

jokelbaf commented 1 year ago

When retrying request with solved geetest it must be put in headers:

image

An example of response after successful request to daily endpoint with solved geetest:

{
    "retcode": 0,
    "message": "OK",
    "data": {
        "code": "ok",
        "first_bind": false,
        "gt_result": {
            "risk_code": 0,
            "gt": "",
            "challenge": "",
            "success": 0,
            "is_risk": false
        }
    }
}