CAPSOLVER
Blog
Solve reCaptcha v2

Solve reCaptcha v2

Logo of CapSolver

Rajinder Singh

Deep Learning Researcher

18-May-2023

Solving reCaptcha V2 with CapSolver API

If you're struggling with reCaptcha v2 and need a way to solve it, this guide is for you. We'll use the CapSolver API to solve reCaptcha v2 easily. You can either use your own proxies with ReCaptchaV2Task or use the server's built-in proxy with ReCaptchaV2TaskProxyLess.

Creating a Task

To solve reCaptcha v2, you first need to create a task using the createTask method.

Here's the structure of the task object:

  • type: Required. This should be ReCaptchaV2Task or ReCaptchaV2TaskProxyLess.
  • websiteURL: Required. This is the web address of the website using reCaptcha v2.
  • websiteKey: Required. This is the domain's public key.
  • proxy: Optional. If you're using a proxy, you can include it here.
  • isInvisible: Optional. If the reCaptcha doesn't have pageAction, set this to true.
  • userAgent: Optional. If you're emulating a browser, include its User-Agent here.
  • cookies: Optional. If you need to use cookies, include them here.

Here's an example request:

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ReCaptchaV2Task",
    "websiteURL": "site",
    "websiteKey": "site key",
    "isInvisible": false,
    "userAgent": "",
    "cookies": [
      {
        "name": "__Secure-3PSID",
        "value": "sdadasdasdsda"
      },
      {
        "name": "__Secure-3PAPISID",
        "value": "sd/AytXQTb6RUALqxSEL"
      }
    ],
    "proxy": ""
  }
}

Once the task is successfully submitted, you'll receive a Task ID in the response:

{
    "errorId": 0,
    "errorCode": "",
    "errorDescription": "",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

Getting Results

Once you have the Task ID, you can use it to retrieve the solution. Submit the Task ID with the getTaskResult method. The results should be ready within an interval of 1s to 10s.

Here's an example request:

{
    "clientKey": "YOUR_API_KEY",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

The response will include the solution token:

{
    "errorId": 0,
    "errorCode": null,
    "errorDescription": null,
    "solution": {
        "userAgent": "xxx", 
        "expireTime": 1671615324290, 
        "gRecaptchaResponse": "3AHJ....." // This is the solution token
    },
    "status": "ready"
}

Solve reCaptcha v2 with Python:

# Install the CapSolver SDK
# pip install --upgrade capsolver

# Set the CapSolver API key
# export CAPSOLVER_API_KEY='YOUR_API_KEY'

import capsolver
# capsolver.api_key = 'YOUR_API_KEY'

# Solve a reCAPTCHA v2 challenge
solution = capsolver.solve({
    "type": "ReCaptchaV2TaskProxyLess",
    "websiteURL": "site url",
    "websiteKey": "site key",
})

Solve reCaptcha v2 with GO:

package main

import (
    "fmt"
    capsolver_go "github.com/capsolver/capsolver-go"
    "log"
)

func main() {
    // Install the CapSolver SDK
    // go get github.com/capsolver/capsolver-go

    // Set the CapSolver API key
    // export CAPSOLVER_API_KEY='YOUR_API_KEY'
    // or
    // capSolver := CapSolver{apiKey:"YOUR_API_KEY"}

    capSolver := capsolver_go.CapSolver{}
    solution, err := capSolver.Solve(map[string]any{
        "type": "ReCaptchaV2TaskProxyLess",
        "websiteURL": "https://www.google.com/recaptcha/api2/demo",
        "websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
    })
    if err != nil {
        log.Fatal(err)
        return
    }
    fmt.Println(solution)
}

Please replace YOUR_API_KEY with your actual CapSolver API key, and replace the websiteURL and websiteKey with the actual website URL and website key for the reCAPTCHA challenge you are trying to solve

Pricing

For information on pricing, please visit our pricing page.

More Information of how to solve reCaptcha v2

Visit this page

Capsolver Team 💜

Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.

More

How to Solve reCAPTCHA v2 with Rust
How to Solve reCAPTCHA v2 with Rust

Learn how to solve reCaptcha v2 using Rust and the Capsolver API. This guide covers both proxy and proxyless methods, providing step-by-step instructions and code examples for integrating reCaptcha v2 solving into your Rust applications.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

17-Oct-2024

Guide to Solving reCAPTCHA v3 with High Scores in Python
Guide to Solving reCAPTCHA v3 with High Scores in Python

This guide will walk you through effective strategies and Python techniques to solve reCAPTCHA v3 with high scores, ensuring your automation tasks run smoothly.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

18-Sep-2024

Best Chrome Captcha Extensions for Solving reCAPTCHA in 2024
Best Chrome Captcha Extensions for Solving reCAPTCHA in 2024

CAPTCHA, especially reCAPTCHA, can hinder automation. CapSolver’s Chrome extension provides an AI-driven, seamless solution for 2024.

reCAPTCHA
Logo of CapSolver

Ethan Collins

12-Sep-2024

How to Handle Multiple reCAPTCHA Challenges Concurrently
How to Handle Multiple reCAPTCHA Challenges Concurrently

Learn how to handle multiple reCAPTCHA challenges concurrently in web scraping projects. This blog explains different types of reCAPTCHA, how to identify them using tools like Capsolver, and automating CAPTCHA-solving using Python and threading.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

10-Sep-2024

How to Integrate reCAPTCHA v2 Solutions in Python for Data Extraction
How to Integrate reCAPTCHA v2 Solutions in Python for Data Extraction

Learn how to integrate reCAPTCHA v2 solutions into Python for seamless data extraction. Explore reCAPTCHA versions, understand data extraction, and follow a simple example using Capsolver to automate solving reCAPTCHA v2 challenges.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

10-Sep-2024

Solving reCAPTCHA v3 Enterprise Challenges with Python and Selenium
Solving reCAPTCHA v3 Enterprise Challenges with Python and Selenium

How to solve reCAPTCHA v3 Enterprise challenges using Python and Selenium, the popular browser automation tool.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

06-Sep-2024