for example, take the below code.
func handleTurnstileCaptcha() {
cap := api2captcha.CloudflareTurnstile{SiteKey: "0x4AAAAAAADnPIDROrmt1Wwj", Url: "https://account.jagex.com"}
solver := api2captcha.NewClient("CENSORED_API_KEY")
solution, err := solver.Send(cap.ToRequest())
if err != nil {
zl.ErrorErr("Failed to solve captcha: ", err)
log.Print(err)
log.Print(cap.ToRequest())
log.Print(solution)
}
if solution != "" {
zl.Info("Got captcha solution: " + solution)
}
}
2024/05/01 04:05:43 api2captcha: API error
2024/05/01 04:05:43 {map[method:turnstile pageurl:account.jagex.com sitekey:0x4AAAAAAADnPIDROrmt1Wwj] map[]}
When emulating the request this code sends in a http client we can see more details on the resulting error.
POST https://api.2captcha.com/createTask
Accept: application/json
{
"clientKey":"CENSORED_API_KEY",
"task": {
"type":"TurnstileTaskProxyless",
"websiteURL":"https://account.jagex.com",
"websiteKey":"0x4AAAAAAADnPIDROrmt1Wwj"
}
}
---
{
"errorId": 110,
"errorCode": "ERROR_BAD_PARAMETERS",
"errorDescription": "The required captcha parameters in your reques are missing or have incorrect format. Please make sure your request payload has proper format for selected task type."
}
It seems the 2captcha api is expecting additional parameters, that the CloudflareTurnstile struct does not currently contain.