All Projects → 2captcha → 2captcha-python

2captcha / 2captcha-python

Licence: other
Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to 2captcha-python

2captcha-php
PHP package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 25 (-82.14%)
Mutual labels:  recaptcha, captcha, captcha-solving, captcha-breaking, geetest, 2captcha, anticaptcha, captcha-recognition, recaptcha-v2, recaptcha-v2-captcha-solver, hcaptcha, recaptcha-v3, clickcaptcha, rotatecaptcha, funcaptcha, keycaptcha, arkoselabs
2captcha-go
Golang Module for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 31 (-77.86%)
Mutual labels:  recaptcha, captcha, captcha-solving, captcha-breaking, geetest, anticaptcha, recaptcha-v2, hcaptcha, recaptcha-v3, clickcaptcha, rotatecaptcha, funcaptcha, keycaptcha, arkoselabs
dcat-auth-captcha
Sliding captcha for dcat-admin auth / dcat-admin登陆 滑动验证插件 多平台支持
Stars: ✭ 38 (-72.86%)
Mutual labels:  recaptcha, captcha, geetest, hcaptcha
imagetyperz-api-python3
imagetyperz-api-python3 - is a super easy to use bypass captcha API wrapper for imagetyperz.com captcha service
Stars: ✭ 25 (-82.14%)
Mutual labels:  captcha, 2captcha, anticaptcha, recaptcha-v2-captcha-solver
go-captcha
Go Captcha is a behavioral captcha, which implements the generation of random verification text and the verification of click position information.
Stars: ✭ 86 (-38.57%)
Mutual labels:  captcha, clickcaptcha, funcaptcha, keycaptcha
simple-recaptcha-v3
🤖 This repository contains simple reCAPTCHA v3 integration for your Laravel application.
Stars: ✭ 25 (-82.14%)
Mutual labels:  recaptcha, captcha, recaptcha-v3
TikTokBot
Bot save videos from instagram and then post them to Tik-Tok
Stars: ✭ 21 (-85%)
Mutual labels:  captcha, captcha-solving, captcha-breaking
Awesome Web Scraping
List of libraries, tools and APIs for web scraping and data processing.
Stars: ✭ 4,510 (+3121.43%)
Mutual labels:  captcha-solving, captcha-breaking, captcha-recognition
Captcha-Tools
All-in-one Python (And now Go!) module to help solve captchas with Capmonster, 2captcha and Anticaptcha API's!
Stars: ✭ 23 (-83.57%)
Mutual labels:  recaptcha, captcha, hcaptcha
Buster
Captcha solver extension for humans
Stars: ✭ 4,244 (+2931.43%)
Mutual labels:  recaptcha, captcha, captcha-solving
captcha-solver
Library and CLI for automating captcha verification across multiple providers.
Stars: ✭ 101 (-27.86%)
Mutual labels:  recaptcha, captcha, captcha-solving
hcaptcha-solver-python-selenium
hCaptcha solver and bypasser for Python Selenium. Simple website to try to solve hCaptcha.
Stars: ✭ 32 (-77.14%)
Mutual labels:  captcha, hcaptcha
recaptcha2
Easy verifier for google reCAPTCHA version 2 for Node.js and Express.js
Stars: ✭ 48 (-65.71%)
Mutual labels:  recaptcha, captcha
captcha-breaking-library
Neural network, contour analysis, bitmap vector subtraction CAPTCHA solving library and scripting language with perceptive color space segmentation
Stars: ✭ 76 (-45.71%)
Mutual labels:  captcha, captcha-breaking
CapMonsterCloud
a C# wrapper for CapMonster Cloud API
Stars: ✭ 17 (-87.86%)
Mutual labels:  recaptcha, captcha
react-recaptcha-x
a React reCAPTCHA version 3 and version 2 (checkbox) component in one.
Stars: ✭ 21 (-85%)
Mutual labels:  recaptcha, recaptcha-v3
wp-recaptcha-integration
WordPress reCaptcha integration supporting Ninja Forms and Contact Form 7
Stars: ✭ 50 (-64.29%)
Mutual labels:  recaptcha, captcha
Server-Captcha
Protect Your Server From Automated Bots With Captcha Now !
Stars: ✭ 18 (-87.14%)
Mutual labels:  recaptcha, captcha
opensea automatic uploader
(Bypass reCAPTCHAs) A Selenium Python bot to automatically and bulky upload and list your NFTs on OpenSea (all metadata integrated - Ethereum and Polygon supported); reCAPTCHA solver & bypasser included.
Stars: ✭ 205 (+46.43%)
Mutual labels:  recaptcha, captcha
hcaptcha-bundle
A Symfony 4+ bundle to bring hCaptcha into your forms
Stars: ✭ 15 (-89.29%)
Mutual labels:  captcha, hcaptcha

Python Module for 2Captcha API

The easiest way to quickly integrate 2Captcha captcha solving service into your code to automate solving of any types of captcha.

Installation

This package can be installed with Pip:

pip3 install 2captcha-python

Configuration

TwoCaptcha instance can be created like this:

from twocaptcha import TwoCaptcha

solver = TwoCaptcha('YOUR_API_KEY')

Also there are few options that can be configured:

config = {
            'server':           '2captcha.com',
            'apiKey':           'YOUR_API_KEY',
            'softId':            123,
            'callback':         'https://your.site/result-receiver',
            'defaultTimeout':    120,
            'recaptchaTimeout':  600,
            'pollingInterval':   10,
        }
solver = TwoCaptcha(**config)

TwoCaptcha instance options

Option Default value Description
server 2captcha.com API server. You can set it to rucaptcha.com if your account is registered there
softId - your software ID obtained after publishing in 2captcha sofware catalog
callback - URL of your web-sever that receives the captcha recognition result. The URl should be first registered in pingback settings of your account
defaultTimeout 120 Polling timeout in seconds for all captcha types except ReCaptcha. Defines how long the module tries to get the answer from res.php API endpoint
recaptchaTimeout 600 Polling timeout for ReCaptcha in seconds. Defines how long the module tries to get the answer from res.php API endpoint
pollingInterval 10 Interval in seconds between requests to res.php API endpoint, setting values less than 5 seconds is not recommended

IMPORTANT: once callback is defined for TwoCaptcha instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL. To get the answer manually use getResult method

Solve captcha

When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.

Captcha options

Option Default Value Description
numeric 0 Defines if captcha contains numeric or other symbols see more info in the API docs
minLength 0 minimal answer lenght
maxLength 0 maximum answer length
phrase 0 defines if the answer contains multiple words or not
caseSensitive 0 defines if the answer is case sensitive
calc 0 defines captcha requires calculation
lang - defines the captcha language, see the list of supported languages
hintImg - an image with hint shown to workers with the captcha
hintText - hint or task text shown to workers with the captcha

Below you can find basic examples for every captcha type. Check out examples directory to find more examples with all available options.

Normal Captcha

To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.

result = solver.normal('path/to/captcha.jpg', param1=..., ...)
# OR
result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)

Text Captcha

This method can be used to bypass a captcha that requires to answer a question provided in clear text.

result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)

ReCaptcha v2

Use this method to solve ReCaptcha V2 and obtain a token to bypass the protection.

result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                          url='https://mysite.com/page/with/recaptcha',
                          param1=..., ...)

ReCaptcha v3

This method provides ReCaptcha V3 solver and returns a token.

result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                            url='https://mysite.com/page/with/recaptcha',
                            version='v3',
                            param1=..., ...)

FunCaptcha

FunCaptcha (Arkoselabs) solving method. Returns a token.

result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                            url='https://mysite.com/page/with/funcaptcha',
                            param1=..., ...)

GeeTest

Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.

result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
                        challenge='12345678abc90123d45678ef90123a456b',
                        url='https://www.site.com/page/',
                        param1=..., ...)

hCaptcha

Use this method to solve hCaptcha challenge. Returns a token to bypass captcha.

result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
                            url='https://www.site.com/page/', 
                            param1=..., ...)

KeyCaptcha

Token-based method to solve KeyCaptcha.

result = solver.keycaptcha(s_s_c_user_id=10,
    				   s_s_c_session_id='493e52c37c10c2bcdf4a00cbc9ccd1e8',
    				   s_s_c_web_server_sign='9006dc725760858e4c0715b835472f22-pz-',
    				   s_s_c_web_server_sign2='2ca3abe86d90c6142d5571db98af6714',
    				   url='https://www.keycaptcha.ru/demo-magnetic/', 
    				   param1=..., ...)

Capy

Token-based method to bypass Capy puzzle captcha.

result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
                     url='http://mysite.com/',
                     api_server='https://jp.api.capy.me/',
                     param1=..., ...)

Grid

Grid method is originally called Old ReCaptcha V2 method. The method can be used to bypass any type of captcha where you can apply a grid on image and need to click specific grid boxes. Returns numbers of boxes.

result = solver.grid('path/to/captcha.jpg', param1=..., ...)

Canvas

Canvas method can be used when you need to draw a line around an object on image. Returns a set of points' coordinates to draw a polygon.

result = solver.canvas('path/to/captcha.jpg', param1=..., ...)

ClickCaptcha

ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.

result = solver.coordinates('path/to/captcha.jpg', param1=..., ...)

Rotate

This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.

result = solver.rotate('path/to/captcha.jpg', param1=..., ...)

Other methods

send / getResult

These methods can be used for manual captcha submission and answer polling.

import time
. . . . . 


id = solver.send(file='path/to/captcha.jpg')
time.sleep(20)

code = solver.get_result(id)

balance

Use this method to get your account's balance

balance = solver.balance()

report

Use this method to report good or bad captcha answer.

solver.report(id, True) # captcha solved correctly
solver.report(id, False) # captcha solved incorrectly

Error handling

If case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use try except to handle exceptions.

Try:
    result = solver.text('If tomorrow is Saturday, what day is today?')
Except ValidationException as e:
    # invalid parameters passed
	print(e)
Except NetworkException as e:
	# network error occurred
	print(e)
Except ApiException as e:
    # api respond with error
	print(e)
Except TimeoutException as e:
    # captcha is not solved so far
	print(e)

Proxies

You can pass your proxy as an additional argumen for methods: recaptcha, funcaptcha and geetest. The proxy will be forwarded to the API to solve the captcha.

proxy={
    'type': 'HTTPS',
    'uri': 'login:password@IP_address:PORT'
}

Async calls

You can also make async calls with asyncio, for example:

import asyncio
import concurrent.futures
from twocaptcha import TwoCaptcha

captcha_result = await captchaSolver(image)

async def captchaSolver(image):
    loop = asyncio.get_running_loop()
    with concurrent.future.ThreadPoolExecutor() as pool:
        result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
        return result
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].