RecaptchaV2EnterpriseTask
The object contains data for Google reCAPTCHA Enterprise solving task. To provide solid universality for solving this type of task we have reproduce every piece of environment used for an automation task you plan to complete. Including, proxy access, browser's user-agent, cookies (optionally).
This type of captcha has no visual differences from ReCaptcha v.2, you can see the difference using the captcha code, for example in developer tools under the Network tab in Queries:
Request URL (anchor): https://www.google.com/recaptcha/enterprise/anchor?ar=1&k=6Lf26sUnAAAAAIKLuWNYgRsFUfmI-3Lex3xT5N-s&co=aHR0cHM6Ly8yY2FwdGNoYS5jb206NDQz&hl=en&v=1kRDYC3bfA-o6-tsWzIBvp7k&size=normal&cb=43r1q2d3mx66
This type of captcha might be solved a bit longer than usual image captcha, but this issue is compensated by the fact that g-captcha-response value we send to you is valid for the next 60 seconds after we solves your ReCaptcha2.
If the proxy is authorized by IP, then be sure to add 116.203.55.208 to the white list.
Request parameters
- RecaptchaV2EnterpriseTaskProxyless (without proxy)
- RecaptchaV2EnterpriseTask (using proxy)
type
<string>requiredRecaptchaV2EnterpriseTaskProxyless
websiteURL
<string>requiredAddress of a webpage with Google ReCaptcha Enterprise.
websiteKey
<string>requiredRecaptcha website key.<div class="g-recaptcha" data-sitekey="THIS_ONE"></div>
or <iframe title="reCAPTCHA" src="...;k=6LdIFr0ZAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH&...
, where 6LdIFr0ZAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH
- websiteKey
enterprisePayload
<string>optionalSome implementations of the reCAPTCHA Enterprise widget may contain additional parameters that are passed to the “grecaptcha.enterprise.render” method along with the sitekey. For example: <pre lang="js" ><code>grecaptcha.enterprise.render("some-div-id", { sitekey: "6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16" theme: "dark" s: "2JvUXHNTnZl1Jb6WEvbDyB...ugQA" });</code></pre>
apiDomain
<string>optionalDomain address from which to load reCAPTCHA Enterprise. For example:
- www.google.com
- www.recaptcha.net
Don't use a parameter if you don't know why it's needed.
userAgent
<string>optionalBrowser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser".
cookies
<string>optionalAdditional cookies which we must use during interaction with target page or Google.
Format: cookiename1=cookievalue1; cookiename2=cookievalue2
type
<string>requiredRecaptchaV2EnterpriseTask
websiteURL
<string>requiredAddress of a webpage with Google ReCaptcha Enterprise.
websiteKey
<string>requiredRecaptcha website key.<div class="g-recaptcha" data-sitekey="THIS_ONE"></div>
or <iframe title="reCAPTCHA" src="...;k=6LdIFr0ZAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH&...
, where 6LdIFr0ZAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH
- websiteKey
enterprisePayload
<string>optionalSome implementations of the reCAPTCHA Enterprise widget may contain additional parameters that are passed to the “grecaptcha.enterprise.render” method along with the sitekey. For example: <pre lang="js" ><code>grecaptcha.enterprise.render("some-div-id", { sitekey: "6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16" theme: "dark" s: "2JvUXHNTnZl1Jb6WEvbDyB...ugQA" });</code></pre>
apiDomain
<string>optionalDomain address from which to load reCAPTCHA Enterprise. For example:
- www.google.com
- www.recaptcha.net
Don't use a parameter if you don't know why it's needed.
userAgent
<string>optionalBrowser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser".
cookies
<string>optionalAdditional cookies which we must use during interaction with target page or Google.
Format: cookiename1=cookievalue1; cookiename2=cookievalue2
proxyType
<string>requiredhttp - regular http/https proxy;
https - try this option only if "http" doesn't work (required for some custom proxies);
socks4 - socks4 proxy;
socks5 - socks5 proxy.
proxyAddress
<string>requiredIPv4/IPv6 proxy IP address. Not allowed:
- using of hostnames;
- using transparent proxies (where you can see the client's IP);
- using proxies on local machines.
proxyPort
<integer>requiredProxy port.
proxyLogin
<string>optionalProxy-server login.
proxyPassword
<string>optionalProxy-server password.
For enterprisePayload
- before calling it, you need to replace the grecaptcha.enterprise.render
function with your own and take the value from its parameters. The function exists after loading the script, and the captcha is usually rendered immediately or based on a page event. If the captcha is rendered with the current field s
on the client, then the token will most likely not be accepted.
The original function can be called without the s
field.
apiDomain
is the domain that hosts the API interface for interacting with reCAPTCHA, it is used to verify that the user passes the captcha.
Script
var __test_grc = undefined;
var __test_enterprise = undefined;
var __test_render = undefined;
var __test_render_widget = undefined;
var __test_render_args = undefined; // here will be the object with which render is called.
var __test_handler = {
get: function(target, name, receiver) {
if (name == 'enterprise') {
return __test_enterprise ? __test_enterprise : (__test_enterprise = new Proxy(target[name], __test_handler));
} else if (name == 'render') {
__test_render = target[name];
return (function(a, b) {
__test_render_args = b;
__test_render_widget = a;
return __test_render(a, {sitekey: b.sitekey}); });
} else {
return target[name];
}
}
};
Object.defineProperty(window, 'grecaptcha', {
enumerable: true,
configurable: false,
get: function() {
return __test_grc;
},
set: function(value) {
__test_grc = new Proxy(value, __test_handler);
}
});
Create task method
- RecaptchaV2EnterpriseTaskProxyless (without proxy)
- RecaptchaV2EnterpriseTask (using proxy)
https://api.capmonster.cloud/createTask
Request
{
"clientKey":"API_KEY",
"task": {
"type":"RecaptchaV2EnterpriseTaskProxyless",
"websiteURL":"https://mydomain.com/page-with-recaptcha-enterprise",
"websiteKey":"6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd",
"enterprisePayload": {
"s": "SOME_ADDITIONAL_TOKEN"
}
}
}
Response
{
"errorId":0,
"taskId":407533072
}
https://api.capmonster.cloud/createTask
Request
{
"clientKey":"API_KEY",
"task": {
"type":"RecaptchaV2EnterpriseTask",
"websiteURL":"https://mydomain.com/page-with-recaptcha-enterprise",
"websiteKey":"6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd",
"enterprisePayload": {
"s": "SOME_ADDITIONAL_TOKEN"
},
"proxyType":"http",
"proxyAddress":"8.8.8.8",
"proxyPort":8080,
"proxyLogin":"proxyLoginHere",
"proxyPassword":"proxyPasswordHere",
"userAgent":"userAgentPlaceholder"
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Get task result method
Use the getTaskResult method to request answer for ReCaptcha2. You will get response within 10 - 80 sec period depending on service workload.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"gRecaptchaResponse":"3AHJ_VuvYIBNBW5yyv0zRYJ75VkOKvhKj9_xGBJKnQimF72rfoq3Iy-DyGHMwLAo6a3"
}
}
Property | Type | Description |
---|---|---|
gRecaptchaResponse | String | Hash which should be inserted into Recaptcha2 submit form in <textarea id="g-recaptcha-response" ..></textarea> . It has a length of 500 to 2190 bytes. |
Use SDK Library
- JavaScript
- Python
- C#
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2EnterpriseProxylessRequest, /*RecaptchaV2EnterpriseRequest*/ } 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 recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseProxylessRequest({
websiteURL: 'https://mydomain.com/page-with-recaptcha-enterprise',
websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
enterprisePayload: {
s: 'SOME_ADDITIONAL_TOKEN',
},
});
// const recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseRequest({
// websiteURL: 'https://mydomain.com/page-with-recaptcha-enterprise',
// websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
// enterprisePayload: {
// s: 'SOME_ADDITIONAL_TOKEN',
// },
// proxyType: 'http',
// proxyAddress: '8.8.8.8',
// proxyPort: 8080,
// proxyLogin: 'proxyLoginHere',
// proxyPassword: 'proxyPasswordHere',
// userAgent: 'userAgentPlaceholder',
// });
console.log(await cmcClient.Solve(recaptchaV2EnterpriseRequest));
});
# https://github.com/ZennoLab/capmonstercloud-client-python
# RecaptchaV2EnterpriseProxyless
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaV2EnterpriseProxylessRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonster Cloud API key
cap_monster_client = CapMonsterClient(options=client_options)
recaptcha2request = RecaptchaV2EnterpriseProxylessRequest(
websiteUrl="https://example.com", # Website with the captcha
websiteKey="6Lf26sUnAAAAAIKLuWNYgRsFUfmI-3Lex3xT5N-s", # Replace with your websiteKey
enterprisePayload={
"s": "SOME_ADDITIONAL_TOKEN"
}
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(recaptcha2request)
responses = asyncio.run(solve_captcha())
print(responses)
# ReCaptchaV2Enterprise:
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaV2EnterpriseRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonster Cloud API key
cap_monster_client = CapMonsterClient(options=client_options)
recaptcha2request = RecaptchaV2EnterpriseRequest(
websiteUrl="https://example.com", # Website with the captcha
websiteKey="6Lf26sUnAAAAAIKLuWNYgRsFUfmI-3Lex3xT5N-s", # Replace with your websiteKey
enterprisePayload={
"s": "SOME_ADDITIONAL_TOKEN"
},
proxy_type="http", # Proxy type (http, https, socks5)
proxy_address="8.8.8.8",
proxy_port=8080,
proxy_login="proxyLoginHere",
proxy_password="proxyPasswordHere"
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(recaptcha2request)
responses = asyncio.run(solve_captcha())
print(responses)
// https://github.com/ZennoLab/capmonstercloud-client-dotnet
// RecaptchaV2EnterpriseProxyless
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 recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseProxylessRequest
{
WebsiteUrl = "https://example.com", // Website with the captcha
WebsiteKey = "6Lf26sUnAAAAAIKLuWNYgRsFUfmI-3Lex3xT5N-s", // Replace with your website key
EnterprisePayload = "{\"s\":\"SOME_ADDITIONAL_TOKEN\"}"
};
var recaptchaV2EnterpriseResult = await cmCloudClient.SolveAsync(recaptchaV2EnterpriseRequest);
Console.WriteLine("Captcha Solution: " + recaptchaV2EnterpriseResult.Solution.Value);
}
}
// ReCaptchaV2Enterprise:
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 recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseRequest
{
WebsiteUrl = "https://example.com", // Website with the captcha
WebsiteKey = "6Lf26sUnAAAAAIKLuWNYgRsFUfmI-3Lex3xT5N-s", // Replace with your website key
EnterprisePayload = "{\"s\":\"SOME_ADDITIONAL_TOKEN\"}",
ProxyType = ProxyType.Http,
ProxyAddress = "8.8.8.8",
ProxyPort = 8080,
ProxyLogin = "proxyLoginHere",
ProxyPassword = "proxyPasswordHere"
};
var recaptchaV2EnterpriseResult = await cmCloudClient.SolveAsync(recaptchaV2EnterpriseRequest);
Console.WriteLine("Captcha Solution: " + recaptchaV2EnterpriseResult.Solution.Value);
}
}