CAPSOLVER

How to Solve Captchas Automatically Using CapSolver

Logo of Capsolver

Ethan Collins

Pattern Recognition Specialist

26-Mar-2024

How to Solve Captchas Automatically Using CapSolver

CAPTCHA was developed to differentiate between human users and automated computer programs, serving as a protective barrier for web services. It prevents harmful activities like creating multiple accounts, automated brute force attacks, data scraping, and spamming. CAPTCHA presents a challenge-response test that is easy for humans but challenging for automated algorithms. This article explores various CAPTCHA types and demonstrates the use of CapSolver to bypass these challenges.

Different types of CAPTCHAs

CAPTCHA challenges nowadays come in many different forms and variations, of which the following are a few of the very common ones you'll encounter:

  • ReCaptcha V2&v3: ReCaptcha is a widely used captcha system developed by Google. It includes various types, such as selecting images that match a given description or solving puzzles.

-FunCaptcha: FunCaptcha stands out among CAPTCHA variants by providing users with enjoyable and interactive puzzles. Rather than traditional text-based challenges, FunCaptcha presents users with visually engaging tasks, such as selecting specific objects or solving puzzles. This approach enhances user experience while maintaining a high level of security.

  • hCaptcha: hCaptcha bears a striking resemblance to reCaptcha, with the main distinction being that hCaptcha allows multiple companies to reap the advantages of data labeling performed by users when they interact with websites. In contrast, when using reCaptcha, only Google benefits from the collective efforts of crowdsourced data labeling.

  • Text-based CAPTCHA,Text-based CAPTCHAs are also a very common form of CAPTCHA, requiring the user to correctly identify and enter a series of characters displayed in a distorted or creative font. The accuracy of the response is then used to decide whether to allow access to the website or not

  • Image-based CAPTCHA, in image-based CAPTCHAs, the user must recognise and correctly interact with the image to be granted access. These image challenges are visually compelling and proving challenging for automated scripts, as a result of the complex image recognition capabilities they require, which are often outside the capabilities of automated scripts

How to solve ReCaptcha with CapSolver

As web scraping scenarios become more prevalent, today's CAPTCHA solutions leverage machine learning and artificial intelligence to identify and effectively bypass CAPTCHA challenges, and CapSolver is currently the most effective and affordable solution on the market!

To solve CAPTCHA problems with CapSolver, sign up for a free trial. And here's how to use CapSolver to solve the different types of CAPTCHAs we've summarised above.

Take Recaptcha V2 as example
To solve reCaptcha v2, follow our documentation. Some parameters are required and some are optional. For this example, we will only use the required parameters. The task types for reCAPTCHA v2 are:

  • ReCaptchaV2Task: This task type requires your own proxies.
  • ReCaptchaV2TaskProxyLess: This task type uses the server's built-in proxy.
  • ReCaptchaV2EnterpriseTask: This task type requires your own proxies.
  • ReCaptchaV2EnterpriseTaskProxyLess: This task type uses the server's built-in proxy.

For this example, we will use ReCaptchaV2TaskProxyLess as the site uses standard reCAPTCHA v2. If the site uses Recaptcha Enterprise, you will need to send the correct task type (ReCaptchaV2EnterpriseTaskProxyLess or ReCaptchaV2EnterpriseTask) and ensure all required parameters are included.
If any parameters are missing, you will likely encounter issues with the token not being accepted by the website. You can find all the parameters in this picture:

For get the captcha solved, first you need to submit all the information needed, for this we use the method createTask:

Step 1: Submitting the information to CapSolver

POST https://api.capsolver.com/createTask

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ReCaptchaV2TaskProxyless",
    "websiteURL": "site url",
    "websiteKey": "site key"
  }
}

Step 2: Getting the results

To verify the results, you'll need to continuously poll the getTaskResult API endpoint until the captcha is resolved.

Here's an example request:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
    "clientKey":"YOUR_API_KEY",
    "taskId": "TASKID_OF_CREATETASK" //ID created by the createTask method
}

Once the captcha is successfully resolved, you'll receive a response similar to the one depicted in the following image:

How to solve Funcaptcha with CapSolver

To solve FunCaptcha, the first step involves creating a task with the createTask method. This requires you to provide certain details like the type of task, the URL of the website using FunCaptcha, the public domain key, and more. Here's an overview of the task object structure:

{
  "type": "FunCaptchaTask",
  "websiteURL": "URL of the website using FunCaptcha",
  "websitePublicKey": "Public domain key",
  "funcaptchaApiJSSubdomain": "A special subdomain of funcaptcha.com",
  "data": "Additional parameter that may be required by FunCaptcha",
  "proxy": "Proxy details",
  "userAgent": "Browser's User-Agent used in emulation"
}

You can send a POST request to create a task using the CapSolver API like this:

{
  "clientKey":"YOUR_API_KEY",
  "task":
  {
    "type": "FunCaptchaTask",
    "websiteURL":"https://funcaptcha.com/",
    "websitePublicKey":"00000000-0000-0000-0000-000000000000"
    "proxy":"Your_own_proxy"
  }
}

Once you've submitted the task, you should receive a 'Task ID' in the response if it's successful

Retrieving the result of the task

After you've created the task, you can retrieve the result using the getTaskResult method. Depending on the system load, the results can be obtained within an interval of 1 to 20 seconds.

Here's an example of a POST request to get the task result:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
  "clientKey": "YOUR_API_KEY",
  "taskId": "Task ID received from the createTask method"
}

Once the task status is ready, you should receive the result of the FunCaptcha challenge in the response

How to solve hcaptcha with CapSolver

To solve hCaptcha, the first step involves creating a task with the createTask method. This requires you to provide certain details like the type of task, the URL of the website using hCaptcha, the public domain key, and more. Here's an overview of the task object structure:

{
  "type": "HCaptchaTask",
  "websiteURL": "URL of the website using hCaptcha",
  "websiteKey": "Public domain key",
  "isInvisible": "Boolean value indicating if it's an invisible captcha",
  "proxy": "Proxy details",
  "enableIPV6": "Boolean value indicating if your proxy is ipv6",
  "userAgent": "Browser's User-Agent used in emulation"
}

You can send a POST request to create a task using the Capsolver API like this:

{
 "clientKey":"YOUR_API_KEY",
    "task":
        {
             "type": "HCaptchaTask",
            "websiteURL":"",
            "websiteKey":""
          "proxy":"Your_own_proxy"
        }
    
            
}

Once you've submitted the task, you should receive a 'Task ID' in the response if it's successful

Retrieving the result of the task

After you've created the task, you can retrieve the result using the getTaskResult method. Depending on the system load, the results can be obtained within an interval of 1 to 10 seconds.

Here's an example of a POST request to get the task result:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
  "clientKey": "YOUR_API_KEY",
  "taskId": "Task ID received from the createTask method"
}

Once the task status is ready, you should receive the result of the hCaptcha challenge in the response.

Conclusion

The advent of CapSolver has redefined automated data access and collection. In this article, a number of different CAPTCHAs including recaptcha, funcaptcha, hcaptcha, etc. are presented along with steps on how CapSolver can circumvent these captchas. Whilst CapSolver can potentially provide a way to automate CAPTCHA resolution, it is critical to be aware of the ethnic and legislative implications of its use and to ensure that it is used in a responsible and non-malicious manner.

More

Solving 403 Forbidden Errors When Crawling Websites with Python
Solving 403 Forbidden Errors When Crawling Websites with Python

Learn how to overcome 403 Forbidden errors when crawling websites with Python. This guide covers IP rotation, user-agent spoofing, request throttling, authentication handling, and using headless browsers to bypass access restrictions and continue web scraping successfully.

The other captcha
Logo of Capsolver

Sora Fujimoto

01-Aug-2024

How to Use Selenium Driverless for Efficient Web Scraping
How to Use Selenium Driverless for Efficient Web Scraping

Learn how to use Selenium Driverless for efficient web scraping. This guide provides step-by-step instructions on setting up your environment, writing your first Selenium Driverless script, and handling dynamic content. Streamline your web scraping tasks by avoiding the complexities of traditional WebDriver management, making your data extraction process simpler, faster, and more portable.

The other captcha
Logo of Capsolver

Lucas Mitchell

01-Aug-2024

Scrapy vs. Selenium
Scrapy vs. Selenium: What's Best for Your Web Scraping Project

Discover the strengths and differences between Scrapy and Selenium for web scraping. Learn which tool suits your project best and how to handle challenges like CAPTCHAs.

The other captcha
Logo of Capsolver

Ethan Collins

24-Jul-2024

API vs Scraping
API vs Scraping : the best way to obtain the data

Understand the differences, pros, and cons of Web Scraping and API Scraping to choose the best data collection method. Explore CapSolver for bot challenge solutions.

The other captcha
Logo of Capsolver

Ethan Collins

15-Jul-2024

How to solve CAPTCHA With Selenium C#
How to solve CAPTCHA With Selenium C#

At the end of this tutorial, you'll have a solid understanding of How to solve CAPTCHA With Selenium C#

The other captcha
Logo of Capsolver

Rajinder Singh

10-Jul-2024

What is puppeteer
What is puppeteer and how to use in web scraping | Complete Guide 2024

This complete guide will delve into what Puppeteer is and how to effectively use it in web scraping.

The other captcha
Logo of Capsolver

Lucas Mitchell

09-Jul-2024