Solve image captcha
Post an image body and receive text from it. Text can only contain digits, letters, special characters and a space. GIF animations are supported up to 500kb. Custom captchas like "find a cat in this series of images and enter its number" are not supported.
Related tutorial: Learn how to submit a form with an image captcha using Python
Task object
Property | Type | Required | Default value | Purpose |
---|---|---|---|---|
type | String | Yes | ImageToTextTask | Defines the type of task. |
body | String | Yes | File body encoded in base64. Make sure to send it without line breaks. Do not include 'data:image/png,' or similar tags, only clean base64! | |
phrase | Boolean | No | false | |
case | Boolean | No | true | |
numeric | Integer | No | 0 | |
math | Boolean | No | false | |
minLength | Integer | No | 0 | |
maxLength | Integer | No | 0 | |
comment | String | No | Additional comments for workers like "enter red text". The result is not guaranteed and is totally up to the worker. | |
websiteURL | String | No | Optional parameter to distinguish source of image captchas in spending statistics. | |
languagePool | String | No | en | Sets workers' pool language. Only applies to image captchas. At the moment, the following language pools are available: "en" (default): English language queue "rn": group of countries: Russia, Ukraine, Belarus, Kazakhstan |
Request example
Python
Javascript
Go
PHP
Java
C#
bash
#pip3 install anticaptchaofficial
from anticaptchaofficial.imagecaptcha import *
solver = imagecaptcha()
solver.set_verbose(1)
solver.set_key("YOUR_API_KEY_HERE")
# Specify softId to earn 10% commission with your app.
# Get your softId here: https://anti-captcha.com/clients/tools/devcenter
solver.set_soft_id(0)
# optional parameters, see documentation for details
# solver.set_phrase(True) # 2 words
# solver.set_case(True) # case sensitivity
# solver.set_numeric(1) # only numbers
# solver.set_minLength(1) # minimum captcha text length
# solver.set_maxLength(10) # maximum captcha text length
# solver.set_math(True) # math operation result, for captchas with text like 50+5
# solver.set_comment("only green characters") # comment for workers
# solver.set_language_pool("en") # language pool
captcha_text = solver.solve_and_return_solution("captcha.jpeg")
if captcha_text != 0:
print("captcha text "+captcha_text)
else:
print("task finished with error "+solver.error_code)
Task solution object
Property | Type | Purpose |
---|---|---|
text | String | Text from image captcha |
url | String | Web address where we'll store the captcha for the next 24 hours, after which it will be removed. |
Response example
{
"errorId":0,
"status":"ready",
"solution":
{
"text":"deditur",
"url":"http://61.39.233.233/1/147220556452507.jpg"
},
"cost":"0.000700",
"ip":"46.98.54.221",
"createTime":1472205564,
"endTime":1472205570,
"solveCount":"0"
}