How to bypass reCAPTCHA V2/V3 using code and another way

2captcha - Sep 16 - - Dev Community

How to bypass reCAPTCHA v2/v3: Automatically solve and pass Google reCAPTCHA using Python and Selenium, Puppeteer, Javascript, PHP

Bypassing reCAPTCHA

No matter how many times people wrote that the captcha has outlived itself long time ago and no longer works as effectively as its developers would have liked initially, however, the owners of Internet resources continue to protect their projects with captchas. But what is the most popular captcha of our time?

CAPTCHA is annoying, but 2captcha service helps to bypass it. We will consider part of the reCAPTCHA solver service

It is recaptcha. Recaptcha V2, V3, etc., that was created by Google back in 2007. It has been many years since the first recaptcha appeared, but it continues to keep the garland, periodically losing ground to competitors and then winning it back. But recaptcha has never taken the 2nd place in popularity, despite all its imperfections in front of neural networks.

There was a huge number of attempts to create a "recaptcha killer", some were less successful, some only looked like a threat to recaptcha, but in fact turned out to be nothing. Yet the fact remains that the desire of competitors to do something better and more reliable than recaptcha demonstrates its popularity.

Types of reCAPTCHA

ReCAPTCHA can be classified into three versions

  • reCAPTCHA V1

  • reCAPTCHA V2

  • reCAPTCHA V3

Each of them is an improved version of the previous reCAPTCHA . Let's figure it out in more detail:

How to solve reCAPTCHA V1? Easy!

The very first version of the CAPTCHA reCAPTCHA V1 consisted of excerpts of text from scanned books, it was also called a text CAPTCHA. It was a fairly simple CAPTCHA that was very intrusive and annoying to users.

The user was asked to enter text in a special window, now something like this can still be found on old resources, but no one uses reCAPTCHA V1 on normal sites anymore.

ReCAPTCHA V1 was the first version introduced in 2007. It used distorted text from scanned books that users had to type in to prove they weren't bots. This system used user input to digitize books, newspapers, and old radio shows.

It was during the period when Google introduced the first version of reCAPTCHA, that auto reCAPTCHA solvers began to appear, that were easily bypassing the text CAPTCHA. At first they were trained on an array and then put into operation, over time such solvers made fewer and fewer mistakes and saved the owner a lot of time and money.

All kinds of auto reCAPTCHA solver chrome extensions that work with the CAPTCHA recognition service, cope well with the text CAPTCHA. Modern alternatives, like reCAPTCHA solver github, offer refined solutions to these challenges, continuing the evolution of CAPTCHA solvers.

reCAPTCHA v2 – how to bypass images? Where is text?

After realizing that text CAPTCHAs no longer work, a new V2 CAPTCHA was created. It was designed to soothe the irritation of users from the annoyance caused by the first version, increase security when protecting projects and, in general, improve the user experience.

The second version of the reCAPTCHA is an empty field. When you click on it, a check mark appears and the CAPTCHA is passed. Or it might be a pop-up window with traffic lights that you need to find. Traffic lights, of course, are a metaphor, instead of traffic lights, you had to look for various objects. I'm sure you all understand what I'm talking about.

Checkbox ("I am not a robot"): The simplest type of verification, where the user just needs to click on the checkbox. The system analyzes the user's behavior to determine whether it is a human or a bot.

Image tasks: If the system is in doubt, it prompts users to select certain objects in the images (for example, "Select all images with traffic lights").

And there was a lack of methods for bypassing reCAPTCHA V2, such as reCAPTCHA v2 solver, reCAPTCHA v2 invisible solver, and even reCAPTCHA v2 callback solver. Many auto-resolvers stopped working normally, the market began to rebuild, and continues to develop even now, as more and more new parameters that are taken into account when solving reCAPTCHA appear, including solutions like bypass reCAPTCHA v2 and bypass reCAPTCHA v2 invisible.

Despite the novelty, the second version also greatly irritated ordinary people, and that negativity did not go away. The system was imperfect, which prompted Google to go ahead and create new products, as developers struggled with challenges like google reCAPTCHA v2 bypass and sought automated solutions.

Google reCAPTCHA v3 – how to bypass something invisible?

The decision not to annoy the users was pursued by Google at all stages of creating reCAPTCHA, but how to achieve that? By hiding the reCAPTCHA. So the third version became invisible. It works in the background, continuously monitoring user actions on the site and assigning them a risk score (from 0.1 to 1.0) based on their behavior. This evolution led to the need for solutions capable of interacting with this more complex system, such as various reCAPTCHA v3 solvers and techniques for bypassing reCAPTCHA V3.

Websites can set thresholds for risk assessments, determining the level of interaction or verification depending on the perceived risk. If the owner wants to maximize the user experience, they set a lower score and vice versa. As more sophisticated methods were developed, some began to explore options like bypassing reCAPTCHA V3 using different programming languages or tools. Thus, Google has given owners a choice between user experience and protection, and it is not so difficult to find a balance in this case.

Python and reCAPTCHA, what are the top reCAPTCHA solvers in Python?

The most popular programming language is definitely Python, the code for this programming language is searched in 5 out of 10 cases when people google "How to bypass reCAPTCHA" on the Internet (not taking into account queries that contain the word Python, such as "how to bypass reCAPTCHA in Python", "Python reCAPTCHA solver", or "Python reCAPTCHA bypass", and so on).

The easiest way to implement all this will be with using modules that just need to be connected in an executable file. After studying the Internet, I have identified the following popular modules with which you can recognize reCAPTCHA (by the way, with all these modules you can recognize other types of CAPTCHA):

Python module for 2Captcha to avoid reCAPTCHA (CAPTCHA solver API)

The official module from the captcha recognition service 2Captcha (2captcha-python) is designed for easy integration with their API. The module has advanced functionality and supports proxy configuration. The module is maintained and regularly updated, and can be used for parsing web resources and automation. This module is often used in conjunction with Python reCAPTCHA solver approaches, making it a powerful tool for those looking to bypass reCAPTCHA v2 Python.

The service is ideal for users that focus on reliability in CAPTCHA recognition, as well as those who need official support from the 2Captcha service. Python bypass reCAPTCHA techniques are effectively implemented using this module, especially for tasks requiring stability and support.

The module supports asynchronous operations.

Google reCAPTCHA solver module for Python

A module 2captcha-solver for solving reCAPTCHA and some other popular CAPTCHAs (reCAPTCHA (v2, v3), FunCaptcha, and hCaptcha). Its main difference from the previous module is that it is more narrowly focused (supports fewer CAPTCHAs) and can respond less flexibly to updates from the reCAPTCHA, compared with the previous official module. However, it remains a valuable option for those seeking a Python reCAPTCHA v2 solver or even a Python reCAPTCHA v3 solver.

2captcha-solver supports proxy configuration and is especially useful for tasks requiring high performance, thanks to its support for asynchronous operations, which allows you to simultaneously solve multiple reCAPTCHAs.

Module written by Python - reCAPTCHA solver

A multifunctional module captchatools, the main focus of which is on supporting several CAPTCHA recognition services. The functionality of the module is approximately similar to the previous two, it supports proxy configuration and asynchronous operations. For those who need to implement Python reCAPTCHA bypass or Python google reCAPTCHA solver strategies, captchatools offers flexible options.

Based on the fact that the module allows you to integrate CAPTCHA recognition through several services, it has a unique function – brute force search for services. That is, you can use one service as the main one, and others as backup, and when, for example, you run out of funds on the main service, or if the main service could not cope with the task, the CAPTCHA will go to the backup one and will be solved. This way your script will be more automated and will not depend on the stability of one particular service.

Module for bypass reCAPTCHA by Python (for Selenium)

It is a narrowly focused module twocaptcha-extension-python that is used for easy integration with Selenium and Playwright, and supports all types of reCAPTCHA. This module is particularly useful for those who need to implement Python bypass reCAPTCHA via selenium or other similar tasks.

The module can be used without the need to install additional extensions and only the API key is required for the start. Its integration capabilities make it an excellent choice for developers working on Python solve reCAPTCHA projects.

Its main difference from the previous modules is that twocaptcha-extension-python will be difficult to use for automation issues where Selenium or Playwright are not used, since it is used exclusively for the listed services.

Module to bypass reCAPTCHA V2/V3 by Python

A module Captcha-Tools that resembles captchatools in functionality, and it can be called an analog of the specified service. That is, you can use one of them by choice.

All the characteristics are the same: support for multiple services, brute force search for services in the process of CAPTCHA recognition, asynchronous operations, proxy configuration. It's all here, too. Only the developer is different.

Well, and an assumption from me, most likely both of these services will react a little slower than the official modules to changes that occur in CAPTCHA recognition services and which are made by CAPTCHA developers.

I would also like to note that all of these services (not just Twocaptcha-extension-python) can be used together with Selenium and Playwright, the only difference will be in connection and synchronization.

How to bypass reCAPTCHA using Selenium

Selenium is a powerful tool for browser automation, often used to bypass reCAPTCHA in web application testing and automation processes. This framework allows you to simulate user actions such as clicks, text input, and page navigation, making it ideal for handling various types of reCAPTCHA, including reCAPTCHA V3

There are specialized modules designed to work with Selenium that simplify the process of bypassing reCAPTCHA. These modules automate the task of bypassing reCAPTCHA, enabling efficient handling of tasks like identification and circumvention of reCAPTCHA, processing complex scenarios, and interacting with dynamic content on web pages. Using Selenium in combination with these modules significantly enhances the efficiency of automated testing and optimizes processes related to bypassing reCAPTCHA.

How to bypass reCAPTCHA using Python (example of a code)

If you do not trust any third-party modules, I have prepared the most universal code that can be inserted into your Python script with minor modifications and solve the reCAPTCHA automatically. Here is the code itself:

import requests
    import time

    API_KEY = 'Your_API_2Captcha_key'

    def solve_recaptcha_v2(site_key, url):
        payload = {
            'key': API_KEY,
            'method': 'userrecaptcha',
            'googlekey': site_key,
            'pageurl': url,
            'json': 1
        }

        response = requests.post('https://2captcha.com/in.php', data=payload)
        result = response.json()

        if result['status'] != 1:
            raise Exception(f"Error when sending captcha: {result['request']}")

        captcha_id = result['request']

        while True:
            time.sleep(5)
            response = requests.get(f"https://2captcha.com/res.php?key={API_KEY}&action=get&id={captcha_id}&json=1")
            result = response.json()

            if result['status'] == 1:
                print("Captcha solved successfully.")
                return result['request']
            elif result['request'] == 'CAPCHA_NOT_READY':
                print("The captcha has not been solved yet, waiting...")
                continue
            else:
                raise Exception(f"Error while solving captcha: {result['request']}")

    def solve_recaptcha_v3(site_key, url, action='verify', min_score=0.3):
        payload = {
            'key': API_KEY,
            'method': 'userrecaptcha',
            'googlekey': site_key,
            'pageurl': url,
            'version': 'v3',
            'action': action,
            'min_score': min_score,
            'json': 1
        }

        response = requests.post('https://2captcha.com/in.php', data=payload)
        result = response.json()

        if result['status'] != 1:
            raise Exception(f"Error when sending captcha: {result['request']}")

        captcha_id = result['request']

        while True:
            time.sleep(5)
            response = requests.get(f"https://2captcha.com/res.php?key={API_KEY}&action=get&id={captcha_id}&json=1")
            result = response.json()

            if result['status'] == 1:
                print("Captcha solved successfully.")
                return result['request']
            elif result['request'] == 'CAPCHA_NOT_READY':
                print("The captcha has not been solved yet, waiting...")
                continue
            else:
                raise Exception(f"Error while solving captcha: {result['request']}")

    # Usage example for reCAPTCHA v2
    site_key_v2 = 'your_site_key_v2'
    url_v2 = 'https://example.com'
    recaptcha_token_v2 = solve_recaptcha_v2(site_key_v2, url_v2)
    print(f"Received token for reCAPTCHA v2: {recaptcha_token_v2}")

    # Usage example for reCAPTCHA v3
    site_key_v3 = 'your_site_key_v3'
    url_v3 = 'https://example.com'
    recaptcha_token_v3 = solve_recaptcha_v3(site_key_v3, url_v3)
    print(f"Received token for reCAPTCHA v3: {recaptcha_token_v3}")
Enter fullscreen mode Exit fullscreen mode

However, before using the provided script, carefully read the recommendations of the service for recognizing a particular type of recaptcha in order to have an idea how this code works.

Also, do not forget to insert your API key in the code and, of course, install the necessary modules.

JavaScript and reCAPTCHA, how to bypass reCAPTCHA in Javascript using modules

The second most popular language for which users are looking to find ways to bypass reCAPTCHA is node js, about 3 out of 10 requests to bypass reCAPTCHA come to this programming language.

As in the case of Python, it is easiest to recognize reCAPTCHA through special modules, especially since CAPTCHA recognition services are interested in simplifying work for their customers and many create and maintain such modules, here is a list of the most popular ones that can help you bypass reCAPTCHA in JavaScript.

Module to bypass reCAPTCHA using Javascript

The official module for node js from the CAPTCHA recognition service 2Captcha (2captcha), supports most of the known types of CAPTCHA, including reCAPTCHA. An important difference between this module and the others is TypeScript support, which makes it convenient for development of various applications.

All basic settings, including asynchronous operations, proxy settings, etc. are present in the module, which makes it a universal module for solving most types of CAPTCHA. Well, and the fact that the module was created by the 2Captcha service allows us to draw a conclusion about its reliability.

Javascript module for 2Captcha to pass reCAPTCHA

It is also the official module for recognizing the main types of CAPTCHA from the 2Captcha service (2captcha-javascript), and it supports all the same settings as the previous module (with the exception of TypeScript support), but it seemed to me that it was created more with an emphasis on ease of integration and a quick start.

It is simpler than the previous one and, like its predecessor, it solves the main task – bypassing reCAPTCHA. So, if you just need your script (program) written in node js to bypass reCAPTCHA, use this module, and if you need deeper integration, take a closer look at the previous module.

Module to bypass Google reCAPTCHA response

The module is tailored for integration with Puppeteer and allows you to solve reCAPTCHA and other popular types of CAPTCHA.

In addition to the fact that this module is tailored for Puppeteer, it provides the opportunity to choose a provider that solves the CAPTCHA, which also allows you to configure a brute force search for services (as described in the section about modules for Python).

It should be noted that the two previous modules can be integrated into Puppeteer, but captcha-solver provides an out-of-the-box solution, that is, you set it up and forget about it, whereas in the case of 2captcha and 2captcha-javascript, manual processing of the results or configuring this processing may be required.

Javascript module to skip reCAPTCHA

A module from third-party developers that supports the reCAPTCHA solution (Multi-captcha-solver-adapter), as well as some other popular types of CAPTCHA. Several CAPTCHA recognition services are integrated in the module, which allows you to configure a brute force search for services (make one the main one, and make the rest backup ones).

The service is an alternative to 2captcha and 2captcha-javascript, but there may be delays in updating, since the module is not supported by official services, but otherwise its functionality is similar to its competitors.

How to bypass reCAPTCHA in Node JS

As in the case of Python, for those who do not like ready-made solutions, below is a script for solving a CAPTCHA using the node js programming language. I remind you to not forget to install the necessary modules for the code to work, including:

axios
Enter fullscreen mode Exit fullscreen mode

You can install it using this command

npm install axios
Enter fullscreen mode Exit fullscreen mode

Here is the code itself:

const axios = require('axios');
    const sleep = require('util').promisify(setTimeout);

    const API_KEY = 'YOUR_API_KEY_2CAPTCHA'; // Replace with your real API key

    // Function for reCAPTCHA v2 solution
    async function solveReCaptchaV2(siteKey, pageUrl) {
        try {
            // Sending a request for the captcha solution
            const sendCaptchaResponse = await axios.post(`http://2captcha.com/in.php`, null, {
                params: {
                    key: API_KEY,
                    method: 'userrecaptcha',
                    googlekey: siteKey,
                    pageurl: pageUrl,
                    json: 1
                }
            });

            if (sendCaptchaResponse.data.status !== 1) {
                throw new Error(`Error when sending captcha: ${sendCaptchaResponse.data.request}`);
            }

            const requestId = sendCaptchaResponse.data.request;
            console.log(`Captcha sent, request ID: ${RequestId}`);

            // Waiting for the captcha solution
           while (true) {
                await sleep(5000); // Waiting 5 seconds before the next request

                const getResultResponse = await axios.get(`http://2captcha.com/res.php`, {
                    params: {
                        key: API_KEY,
                        action: 'get',
                        id: requestId,
                        json: 1
                    }
                });

                if (getResultResponse.data.status === 1) {
                    console.log('Captcha solved successfully.');
                    return getResultResponse.data.request;
                } else if (getResultResponse.data.request === 'CAPCHA_NOT_READY') {
                    console.log('The captcha has not been solved yet, waiting...');
                } else {
                    throw new Error(`Error while solving captcha: ${getResultResponse.data.request}`);
                }
            }
        } catch (error) {
            console.error(`An error occurred: ${error.message}`);
        }
    }

    // Function for reCAPTCHA v3 solution
    async function solveReCaptchaV3(siteKey, pageUrl, action = 'verify', minScore = 0.3) {
        try {
            // Sending a request for the captcha solution
            const sendCaptchaResponse = await axios.post(`http://2captcha.com/in.php`, null, {
                params: {
                    key: API_KEY,
                    method: 'userrecaptcha',
                    googlekey: siteKey,
                    pageurl: pageUrl,
                    version: 'v3',
                    action: action,
                    min_score: minScore,
                    json: 1
                }
            });

            if (sendCaptchaResponse.data.status !== 1) {
                throw new Error(`Error when sending captcha: ${sendCaptchaResponse.data.request}`);
            }

            const requestId = sendCaptchaResponse.data.request;
            console.log(`Captcha sent, request ID: ${RequestId}`);

            // Waiting for the captcha solution
            while (true) {
                await sleep(5000); // Waiting 5 seconds before the next request

                const getResultResponse = await axios.get(`http://2captcha.com/res.php`, {
                    params: {
                        key: API_KEY,
                        action: 'get',
                        id: requestId,
                        json: 1
                    }
                });

                if (getResultResponse.data.status === 1) {
                    console.log('Captcha solved successfully.');
                    return getResultResponse.data.request;
                } else if (getResultResponse.data.request === 'CAPCHA_NOT_READY') {
                    console.log('The captcha has not been solved yet, waiting...');
                } else {
                    throw new Error(`Error while solving captcha: ${getResultResponse.data.request}`);
                }
            }
        } catch (error) {
            console.error(`An error occurred: ${error.message}`);
        }
    }

    // Usage example for reCAPTCHA v2
    (async () => {
        const siteKeyV2 = 'YOUR_SITE_KEY_V2'; // Replace with the real site key
        const pageUrlV2 = 'https://example.com '; // Replace with the real URL of the page

        const tokenV2 = await solveReCaptchaV2(siteKeyV2, pageUrlV2);
        console.log(`Received token for reCAPTCHA v2: ${tokenV2}`);
    })();

    // Usage example for reCAPTCHA v3
    (async () => {
        const siteKeyV3 = 'YOUR_SITE_KEY_V3'; // Replace with the real site key
        const pageUrlV3 = 'https://example.com '; // Replace with the real URL of the page
        const action = 'homepage'; // Replace with the corresponding action
        const MinScore = 0.5; // Set the minimum allowed score

        const tokenV3 = await solveReCaptchaV3(siteKeyV3, pageUrlV3, action, minScore);
        console.log(`Received token for reCAPTCHA v3: ${tokenV3}`);
    })();`

Also, do not forget to insert your API key into the code, instead of

`"'YOUR_API_KEY_2CAPTCHA'"
Enter fullscreen mode Exit fullscreen mode

PHP and reCAPTCHA, how to bypass reCAPTCHA in php using modules

And the third most popular language for which users are looking to find ways to bypass reCAPTCHA is PHP. I suggest to start with modules, as in the first two cases, and to end with the code. So, the most popular modules for solving reCAPTCHA in PHP are the following:

Module wriiten by PHP using reCAPTCHA bypass API

This module (2captcha-php) makes it easy to integrate the 2Captcha API into your PHP CAPTCHA solution code. It supports CAPTCHA types such as reCAPTCHA, FunCaptcha, GeeTest, and others. The module is designed for quick setup and use, including support for text CAPTCHA and reCAPTCHA v3. It also supports various methods for working with images and audio files. For those looking to bypass reCAPTCHA in PHP, this module offers a reliable and straightforward solution.

Module to reCAPTCHA bypass in Chrome

A module that provides a user-friendly interface for integration with various CAPTCHA services, including 2Captcha (php-captcha-solver). It supports various types of CAPTCHA, such as reCAPTCHA and FunCaptcha. This module is focused on ease of use and quick setup. If you're aiming to bypass reCAPTCHA using PHP, this tool is also a solid option.

In fact, if we compare these two modules, the first one is developed by the 2Captcha service, and the second one is made by the developer community, and both solve the same tasks and have approximately the same set of functionality. However, the second module may be less prompt in terms of updates, unlike the official module.

How to recognize reCAPTCHA in PHP

Well, for those who are not used to using ready-made modules, here is the code for integration directly. The code uses standard PHP functions such as file_get_contents and json_decode, here is the code itself:

<?php

    function solveRecaptchaV2($apiKey, $siteKey, $url) {
        $requestUrl = "http://2captcha.com/in.php?key={$apiKey}&method=userrecaptcha&googlekey={$siteKey}&pageurl={$url}&json=1";

        $response = file_get_contents($requestUrl);
        $result = json_decode($response, true);

        if ($result['status'] != 1) {
            throw new Exception("Error when sending captcha: " . $result['request']);
        }

        $captchaId = $result['request'];

        while (true) {
            sleep(5);
            $resultUrl = "http://2captcha.com/res.php?key={$apiKey}&action=get&id={$captchaId}&json=1";
            $response = file_get_contents($resultUrl);
            $result = json_decode($response, true);

            if ($result['status'] == 1) {
                return $result['request'];
            } elseif ($result['request'] == 'CAPCHA_NOT_READY') {
                continue;
            } else {
                throw new Exception("Error while solving captcha: " . $result['request']);
            }
        }
    }

    function solveRecaptchaV3($apiKey, $siteKey, $url, $action = 'verify', $minScore = 0.3) {
        $requestUrl = "http://2captcha.com/in.php?key={$apiKey}&method=userrecaptcha&googlekey={$siteKey}&pageurl={$url}&version=v3&action={$action}&min_score={$minScore}&json=1";

        $response = file_get_contents($requestUrl);
        $result = json_decode($response, true);

        if ($result['status'] != 1) {
            throw new Exception("Error when sending captcha: " . $result['request']);
        }

        $captchaId = $result['request'];

        while (true) {
            sleep(5);
            $resultUrl = "http://2captcha.com/res.php?key={$apiKey}&action=get&id={$captchaId}&json=1";
            $response = file_get_contents($resultUrl);
            $result = json_decode($response, true);

            if ($result['status'] == 1) {
                return $result['request'];
            } elseif ($result['request'] == 'CAPCHA_NOT_READY') {
                continue;
            } else {
                throw new Exception("Error while solving captcha: " . $result['request']);
            }
        }
    }

    // Usage example for reCAPTCHA v2
    $apiKey = 'YOUR_API_KEY_2CAPTCHA';
    $siteKeyV2 = 'YOUR_SITE_KEY_V2';
    $urlV2 = 'https://example.com';

    try {
        $tokenV2 = solveRecaptchaV2($apiKey, $siteKeyV2, $urlV2);
        echo "Received token for reCAPTCHA v2: {$tokenV2}\n";
    } catch (Exception $e) {
        echo "Error: " . $e->getMessage() . "\n";
    }

    // Usage example for reCAPTCHA v3
    $siteKeyV3 = 'YOUR_SITE_KEY_V3';
    $urlV3 = 'https://example.com';
    $action = 'homepage'; // Specify the appropriate action
    $MinScore = 0.5; // Specify the minimum allowed score

    try {
        $tokenV3 = solveRecaptchaV3($apiKey, $siteKeyV3, $urlV3, $action, $minScore);
        echo "Received token for reCAPTCHA v3: {$tokenV3}\n";
    } catch (Exception $e) {
        echo "Error: " . $e->getMessage() . "\n";
    }

    ?>

    I also remind you of the need to replace some parameters in the code, in particular:
    $apiKey = 'YOUR_API_KEY_2CAPTCHA';
    $siteKeyV2 = 'YOUR_SITE_KEY_V2';
    $urlV2 = 'https://example.com';

Enter fullscreen mode Exit fullscreen mode

Thus, using the examples given, you can solve most of the issues related to reCAPTCHA recognition. You can ask questions in the comments if there are any left!

. . . . . . . . . . . . . . . . .