ComplexImageTask Recaptcha
The object contains data about the task for solving ReCaptcha2 from Google.
Request parameters
type
<string>requiredComplexImageTask
class
<string>requiredrecaptcha
imageUrls
<array>required (if imagesBase64 is not filled)Single image 4x4, 3x3 or a new 1x1 captcha part (in an array). Example: [“https://i.postimg.cc/yYjg75Kv/img1.jpg”]\
imagesBase64
<array>required (if imageUrls is not filled)Single image 4x4, 3x3 or a new 1x1 captcha part in base64 format (in an array). Example: [ “/9j/4AAQSkZJRgABAQEAAAAAAAD…”]
metadata.Grid
<string>requiredImage grid size. Possible values: 4x4, 3x3, 1x1
metadata.TaskDefinition
<string>required (if metadata.Task is not filled)Technical value that defines the task type
How to get TaskDefinition
The data can be found in responses to /recaptcha/{recaptchaApi}/reload
or /recaptcha/{recaptchaApi}/userverify
requests, where recaptchaApi is "enterprise" or "api2" depending on the Recaptcha type. The response contains json, in which one can take a list of TaskDefinitions for loaded captchas.
metadata.Task
<string>required (if metadata.TaskDefinition is not filled)Possible values: Click on traffic lights
and others
Task name (in English).
userAgent
<string>optionalThe browser User-Agent to use when loading images if links were passed in imageUrls. It is required to use a modern browser signature, otherwise Google will return an error asking for a browser update.
websiteURL
<string>optionalURL of the page where the captcha is solved.
Description of parameters
imageUrls: links to images.
imagesBase64: images in Base64 format.
metadata.Grid: additional metadata related to image grid sizes.
metadata.TaskDefinition: task description identifier/type, e.g.: /m/015qff
means "Click on traffic lights".
metadata.Task: additional metadata related to the task.
userAgent: information about the user agent. Current userAgent: userAgentPlaceholder
websiteURL: address of the web page with the captcha.
Create task method
https://api.capmonster.cloud/createTask
Request
{
"clientKey":"API_KEY",
"task": {
"type": "ComplexImageTask",
"class": "recaptcha",
"imageUrls":[ "https://i.postimg.cc/yYjg75Kv/payloadtraffic.jpg" ],
"metadata": {
"Task": "Click on traffic lights",
"Grid": "3x3",
"TaskDefinition": "/m/015qff"
},
"userAgent": "userAgentPlaceholder",
"websiteUrl": "https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=middle"
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Get task result method
Use the getTaskResult method to get the captcha solution. Depending on the system load, you will receive a response after a time ranging from 300ms to 6s.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"answer": [ false, false, false, false, true, false, false, false, false ]
}
}
Property | Type | Description |
---|---|---|
answer | Array | List with boolean values, "true" means that you need to click on the image corresponding to this position. |
Use SDK Library
- JavaScript
- Python
- C#
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, ComplexImageRecaptchaRequest } from '@zennolab_com/capmonstercloud-client';
document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
console.log(await cmcClient.getBalance());
const complexImageRecaptchaRequest = new ComplexImageRecaptchaRequest({
imageUrls: ['https://i.postimg.cc/yYjg75Kv/payloadtraffic.jpg'],
metaData: {
Grid: '3x3',
Task: 'Please click each image containing a mountain',
TaskDefinition: '/m/015qff',
},
websiteURL: 'https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=middle',
});
console.log(await cmcClient.Solve(complexImageRecaptchaRequest));
});
# https://github.com/ZennoLab/capmonstercloud-client-python
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaComplexImageTaskRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonsterCloud API key
cap_monster_client = CapMonsterClient(options=client_options)
complex_image_recaptcha_request = RecaptchaComplexImageTaskRequest(
imagesUrls=["https://i.postimg.cc/yYjg75Kv/payloadtraffic.jpg"], # Replace with your values
metadata={
"Task": "Click on traffic lights",
"Grid": "3x3",
"TaskDefinition": "/m/015qff",
"websiteUrl": "https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=middle", # Website with the captcha
}
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(complex_image_recaptcha_request)
responses = asyncio.run(solve_captcha())
print(responses)
// https://github.com/ZennoLab/capmonstercloud-client-dotnet
using Zennolab.CapMonsterCloud.Requests;
using Zennolab.CapMonsterCloud;
class Program
{
static async Task Main(string[] args)
{
var clientOptions = new ClientOptions
{
ClientKey = "your_api_key" // Replace with your CapMonster Cloud API key
};
var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions);
var complexImageRecaptchaRequest = new RecaptchaComplexImageTaskRequest
{
ImageUrls = new[] { "https://i.postimg.cc/yYjg75Kv/payloadtraffic.jpg" }, // Replace with your image URL
Metadata = new RecaptchaComplexImageTaskRequest.RecaptchaMetadata
{
Task = "Click on traffic lights", // Task description
Grid = RecaptchaComplexImageTaskRequest.RecaptchaMetadata.GridSize.Grid3x3, // Set the grid size
TaskDefinition = "/m/015qff", // Task definition
}
};
var complexImageRecaptchaResult = await cmCloudClient.SolveAsync(complexImageRecaptchaRequest);
Console.WriteLine("Captcha Solution: " + string.Join(", ", complexImageRecaptchaResult.Solution.Answer));
}
}