NopeCHALLC / nopecha-extension

Automated CAPTCHA solver for your browser. Works with Selenium, Puppeteer, Playwright, and more.
MIT License
6.63k stars 96 forks source link

HTTP 409 (Conflict) hcaptcha error. #39

Closed oyunvfg closed 6 months ago

oyunvfg commented 9 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}";
            }
        }
    }
oyunvfg commented 9 months ago

c# windows forms

NopeCHALLC commented 6 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.