NopeCHALLC / nopecha-python

Automated CAPTCHA solver for Python.
MIT License
1.01k stars 10 forks source link

HTTP 409 (Conflict) hcaptcha error. #4

Closed oyunvfg closed 5 months ago

oyunvfg commented 7 months ago

private async void nopecatpchatken_Click(object sender, EventArgs e) { string apiKey = "I'm Api Key"; // API anahtarınızı buraya ekleyin string siteKey = "ab803303-ac41-41aa-9be1-7b4e01b91e2c"; string apiUrl = "https://api.nopecha.com/token";

    // hCaptcha request
    using (HttpClient client = new HttpClient())
    {
        var requestContent = new
        {
            type = "hcaptcha",
            sitekey = siteKey,
            url = "https://nopecha.com/demo/hcaptcha#hard",
            key = apiKey
        };

        var response = await client.PostAsJsonAsync(apiUrl, requestContent);

        if (response.IsSuccessStatusCode)
        {
            var responseData = await response.Content.ReadAsAsync<dynamic>();
            string job_id = responseData.data;

            // hCaptcha HTTP 409 ERROR
            var tokenResponse = await client.GetStringAsync($"{apiUrl}?key={apiKey}&id={job_id}");
            var hCaptchaToken = tokenResponse.Trim();

           nopecaptchatext.Text = $"hCaptcha Token: {hCaptchaToken}";
        }
        else
        {
            nopecaptchatext.Text =  $"Error: {response.StatusCode} - {response.ReasonPhrase}";
        }
    }
}
NopeCHALLC commented 5 months ago

You are sending a POST request to upload the hCaptcha job, which returns the ID of this job.

The solution for this job is retrieved with a GET request with the ID from the POST request.

Please refer to the API documentation for more information.