Decaptcher

CAPTCHAFORUM

Administrator
1642757161983.png

Python library for working with anit-captcha services. Supports all types of captchas available on the rucaptcha / 2captcha service.
GitHub Documentation

Installation
Use command:
pip install -e git://github.com/lorien/decaptcher#egg=decaptcher

Usage
Twocaptcha Backend Example
Service website is https://2captcha.com
Code:
from decaptcher import Service

solver = Service('twocaptcha', api_key='2captcha.com API HERE')
print(solver.process_file('captcha.png'))
# or
with open('captcha.png') as inp:
    print(solver.process(inp.read()))
# or
with open('captcha.png') as inp:
    print(solver.process(inp))
# You can pass extra parameters (described in 2captcha documentation)
# using task_options arguments:
print(solver.process_file('captcha.png', task_options={
    'regsense': 1,
    'min_len': 4,
}))


Solving custom captcha type using 2captcha.com
Decaptcher library supports any custom captcha supported by 2captcha.com service. Just use task_options argument to pass all required parameters. For example, to solve text captcha do:
Code:
from decaptcher import Service

solver = Service('twocaptcha', api_key='2captcha.com API HERE')
print(solver.process(task_options={
    'lang': 'en',
    'textcaptcha': 'Name of first day of week',
}))


Getting captcha ID along the solution
To get catpcha ID pass verbose=True to process method:
Code:
solver = Service('twocaptcha', api_key='2captcha.com API HERE')
print(solver.process_file('captcha.png', verbose=True))

You get result like:
{"task_id": "captcha ID", "result": "captcha text"}


Rucaptcha Backend Example
Service website is https://rucaptcha.com
Code:
from decaptcher import Service

solver = Service('rucaptcha', api_key='RUCAPTCHA_KEY')
print(solver.process_file('captcha.png'))


Browser Backend Example
Browser backend just displays captcha in default browser and wait you enter solution in console.
Code:
from decaptcher import Service

solver = Service('browser')
print(solver.process_file('captcha.png'))