Bypass captcha in Python

CAPTCHAFORUM

Administrator
1663814080799.png

Integrate Python package for solve captcha automatically on any site.

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

1663814137504.png

Installation
The script package can be installed using the package installer or manually.

PiP
To automatically install a library package, you need to use the standard Python package solution - Pip. Download it from the link and install according to the instructions. After installing the application, use the command:

Code:
pip3 install 2captcha-python

We invite you to explore our GitHub repository where you can find libraries and modules for easy integration with our API.


Configuration
An instance of the TwoCaptcha class can be created like this:

Code:
from twocaptcha import TwoCaptcha

solver = TwoCaptcha('YOUR_API_KEY')

You also have the ability to customize some of the options for the created instance:

Code:
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)

1663814373597.png

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

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.

Code:
result = solver.normal('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.
Code:
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.
Code:
result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
  url='https://mysite.com/page/with/recaptcha',
  param1=..., ...)

reCAPTCHA v3
This method to bypass reCAPTCHA V3 solver and returns a token.
Code:
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.
Code:
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.
Code:
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.
Code:
result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
  url='https://www.site.com/page/',
  param1=..., ...)

KeyCaptcha
Token-based method to solve KeyCaptcha.
Code:
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.
Code:
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.
Code:
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.
Code:
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.
Code:
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.
Code:
result = solver.rotate('path/to/captcha.jpg', param1=..., ...)



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

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

Code:
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.

Code:
balance = solver.balance()

report
Use this method to report good or bad captcha answer.

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


Go to 2captcha.com
 
Last edited: