使用 CapMonster Cloud 解决 reCAPTCHA 企业问题:完整指南
现代网站安全系统越来越难以被各种脚本绕过。智能算法、机器学习和行为分析技术为阻止潜在威胁建立了一道坚固的屏障。标准的验证码已经是一个严重的障碍,而针对大型公司和具有高安全要求的网站开发的解决方案甚至更加先进--这些解决方案包括 reCAPTCHA Enterprise 。
在本文中,我们将详细介绍什么是 reCAPTCHA Enterprise,它与标准版本有何不同,以及它如何帮助保护网络资源免受各种攻击。您将学习如何在网站上识别这种验证码,研究其主要特征和参数,还将了解验证码解决方案的示例,以便成功验证并进一步与网站资源进行交互。
What is reCAPTCHA Enterprise?
现在,reCAPTCHA Enterprise 是谷歌著名安全系统的一个版本,专为安全性要求较高的网站和应用程序而设计。与普通的 reCAPTCHA v2 和 v3 版本相比,它提供了更多的功能和改进的安全机制,因此更适合大型公司、金融机构和其他处理敏感数据的组织使用。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">特性和优点 应用了比标准版本更复杂的安全机制。尽管验证方法相同(v2 要求用户执行特定任务,而 v3 则执行行为分析),但企业版具有以下几个显著优势: 与标准版本(非企业版)类似,这些版本在验证用户的方式上有所不同: 用户必须解决一个基于视觉或文本的挑战(例如,用户必须解决一个基于视觉或文本的挑战(例如,用户必须解决一个基于视觉或文本的挑战))。g.,选择带有交通灯的图像)或勾选 "我不是机器人 "框。复选可以是明确的(基于挑战),并要求用户参与。适用于表单、输入和其他单个验证点。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">reCAPTCHA v3: 后台运行的隐形检查。它会评估用户在页面上的行为,并给出 0.0 到 1.0 的风险分数(其中 1.0 代表真实用户,0.0 代表可能的僵尸)。开发人员可根据分数决定采取何种措施(例如阻止访问、要求额外验证)。它是监控网站活动、保护支付页面和分析流量的理想工具。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr"> 如何确定企业版? 要确定网页是否使用了 reCAPTCHA Enterprise,请打开 Browser Developer Tools 并检查页面的源代码: 这种验证码类型可以有效保护网站免受黑客攻击和其他恶意活动。不过,为了达到高尚的目的,可能需要与 reCAPTCHA Enterprise 进行自动化交互。自动解决此类验证码是一项复杂的任务,需要深厚的技术知识,因此求助于特殊服务会更容易,例如, CapMonster Cloud 。这项服务利用人工智能的能力,快速高效地解决验证码问题,大大减少了时间和经济成本。如果您的活动与以下方向相关联,它将成为您不可或缺的助手: - 测试自动化: 开发人员可以为使用 reCAPTCHA 的 Web 应用程序创建自动化测试。要使测试正确运行,您需要模拟其解决方案。 - 质量保证 (QA): 质量工程师可以检查系统性能,包括验证码通过或失败时网站的行为。 - 价格和竞争对手监控: 价格监控公司可以使用自动化功能从安装了验证码的网站收集产品和服务数据。 - 研究数据分析: 科学家和分析师可以为经济、社会或科学研究收集数据。 - Pentestas: 信息安全专家测试网络应用程序的漏洞,包括对机器人和攻击的抵抗能力。 漏洞分析: 漏洞分析: 自动验证码解题还可以帮助那些因行动不便或视觉障碍而难以通过 reCAPTCHA 的用户。在这种情况下,专门的技术可以提供一种更方便、更易于访问的方式来与网站进行交互。 该服务通过浏览器扩展解决 reCAPTCHA Enterprise 问题(适用于 Chrome and Firefox)和 API。如果您需要使用 API 将验证码解决集成到您的代码中,请按照以下步骤操作: CapMonster 云 支持 reCAPTCHA Enterprise 第 2 版解决方案。使用两种任务类型 - RecaptchaV2EnterpriseTaskProxyless(无代理)和 RecaptchaV2EnterpriseTask(使用代理)。它们之间的区别是: RecaptchaV2EnterpriseTaskProxyless: 此类任务不需要指定代理。 CapMonster Cloud 使用自己的代理服务器来解决验证码问题。适用于不需要使用特定地区的 IP 地址或确保用户 IP 与验证码解决服务器匹配的简单任务。 RecaptchaV2EnterpriseTask: 要求指定一个代理服务器来解决验证码问题。这样就可以模拟来自特定 IP 地址的请求。如果网站在解决验证码问题时检查 IP 地址是否匹配,或要求从特定国家访问,则有必要这样做。在有地理或 IP 限制的网站上,可提高成功解决的概率。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">选择最适合您要求的任务类型,并根据您的选择探索其他选项: Use POST method: What the query should look like: 成功回复: Use method getTaskResult获取解决方案。根据系统负载情况,您将在 10 秒至 80 秒后得到响应。使用 POST 方法: 请求: 成功回复: gRecaptchaResponse - 将哈希值替换到表单中的 reCAPTCHA Enterprise 中 <textarea id="g-recaptcha-response" ..></textarea>.长度介于 500 和 2190 字节之间。 For your convenience, the service has its own libraries 用于自动解决多种类型的验证码。让我们以 C#、Python 和 JavaScript 为例: 在大多数情况下,reCAPTCHA Enterprise 解决方案是通过浏览器插入的。这是因为这种验证在客户端工作,使用 JavaScript 执行复杂的检查。您可以使用浏览器自动化工具(如 Puppeteer或 Selenium)。要插入解决方案,您还需要检查页面代码并找到相应的表单,然后在代码中使用该元素并进行验证。 What are differences between Enterprise v2 and v3?
reCAPTCHA v2:
交互自动化
Solution with CapMonster Cloud
查询参数
type<string>mandatory
RecaptchaV2EnterpriseTaskProxyless
websiteURL<string>required
解决验证码问题的页面地址。
websiteKey<string>required
登陆页面上的 reCAPTCHA 识别码密钥。
<div class="g-recaptcha" data-sitekey="THIS_ONE"></div>;
或 <iframe title="reCAPTCHA" src="...;k=6LdIFr0ZAAAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH&...其中 6LdIFr0ZAAAAAO3vz0O0O0OQrtAefzdJcWQM2TMYQH 是网站关键字
enterprisePayload<string>optional
reCAPTCHA Enterprise 部件的某些实现可能会在结构上包含一个额外的 s 字段,该字段将与 sitekey 一起传递给 grecaptcha.enterprise.render 方法。例如:2JvvUXHNTnZl1Jb6WEvbDyB...ugQA of <pre lang="js" ><code>grecaptcha.enterprise.render("some-div-id", { sitekey:"6Lc_aCMTAAAAABx7u2N2N0D1XnVbI_v6ZdbM6rYf16" theme:"dark" s:"2JvUXHNTnZl1Jb6WEvbDyB...ugQA" });</code></pre>;
apiDomain<string>optional
加载 reCAPTCHA 企业的域名地址。例如
- www.google.com
- www.recaptcha.net
除非知道参数的用途,否则请勿使用。
userAgent<string>optional
模拟中使用的浏览器用户代理。必须使用现代浏览器签名,否则 Google 将返回错误信息,要求您更新浏览器。
cookies<字符串>可选
与登陆页面交互时必须使用的附加 cookie。
格式:cookiename1=cookievalue1; cookiename2=cookievalue2
type<string>optional
RecaptchaV2EnterpriseTask
websiteURL<string>required
解决验证码的页面地址。
websiteKey<string>mandatory
登陆页面上的 reCAPTCHA 识别码密钥。
<div class="g-recaptcha" data-sitekey="THIS_ONE"></div>;
或 <iframe title="reCAPTCHA" src="...;k=6LdIFr0ZAAAAAAAO3vz0O0OQrtAefzdJcWQM2TMYQH&...其中 6LdIFr0ZAAAAAO3vz0O0O0OQrtAefzdJcWQM2TMYQH 是网站关键字
enterprisePayload<string>optional
reCAPTCHA Enterprise 部件的某些实现可能会在结构上包含一个额外的 s 字段,该字段将与 sitekey 一起传递给 grecaptcha.enterprise.render 方法。
例如:2JvvUXHNTnZl1Jb6WEvbDyB...ugQA of <pre lang="js" ><code>grecaptcha.enterprise.render("some-div-id", { sitekey:"6Lc_aCMTAAAAABx7u2N2N0D1XnVbI_v6ZdbM6rYf16" theme:"dark" s:"2JvUXHNTnZl1Jb6WEvbDyB...ugQA" });</code></pre>;
apiDomain<string>optional
加载 reCAPTCHA 企业的域名地址。例如
- www.google.com
- www.recaptcha.net
除非知道参数的用途,否则请勿使用。
userAgent<string>optional
模拟中使用的浏览器用户代理。必须使用现代浏览器签名,否则 Google 将返回错误信息,要求您更新浏览器。
cookies<字符串>可选
与登陆页面交互时必须使用的附加 cookie。
格式:cookiename1=cookievalue1; cookiename2=cookievalue2
proxyType<string>mandatory
http - 普通 http/https 代理;
https - 仅当 "http "不起作用时才使用该选项(某些自定义代理需要);
socks4 - socks4 代理;
socks5 - socks5 代理。
proxyAddress<string>mandatory
IPv4/IPv6 代理的 IP 地址。不允许:
使用主机名;
使用透明代理(可以看到客户端 IP);
在本地机器上使用代理。
proxyPort<整数>必填
代理端口。
proxyLogin<字符串>可选
代理服务器登录名。
proxyPassword<string>optional
代理服务器的密码。
任务创建方法
https://api.capmonster.cloud/createTask
{{
"clientKey":"API_KEY"、
"task":{
{ "type":"RecaptchaV2EnterpriseTaskProxyless"、
"websiteURL":"https://mydomain.com/page-with-recaptcha-enterprise"、
"websiteKey":"6Lcg7CMUAAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"、
"enterprisePayload":{
"s":"some_additional_token".
}
}
}
{{
"errorId":0、
"taskId":407533072
}
获取任务结果的方法
https://api.capmonster.cloud/getTaskResult
{
"clientKey":"API_KEY"、
"taskId":407533072
}
{{
"errorId":0、
"status":"ready"、
"solution":{
"gRecaptchaResponse":"3AHJ_VuvYIBNBW5yyv0zRYJ75VkOKvhKj9_xGBJKnQimF72rfoq3Iy-DyGHMwLAo6a3".
}
}
Code samples using official CapMonster Cloud libraries
C#。
https://github.com/ZennoLab/capmonstercloud-client-dotnet
RecaptchaV2EnterpriseProxyless
使用 Zennolab.CapMonsterCloud.Requests;
Zennolab.CapMonsterCloud.Requests
类 程序
{
static async Task Main(string[] args)
{
var clientOptions = new ClientOptions
{
ClientKey = "your_api_key" // 替换为您从 CapMonster Cloud 获取的 API 密钥
};
var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions);
var recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseProxylessRequest
{
WebsiteUrl = "https://example.com", // 带验证码的网站地址
WebsiteKey = "6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s", // 替换为网站密钥。
EnterprisePayload = "{\"s\":\"SOME_ADDITIONAL_TOKEN\"}"// 附加令牌(如果需要)
};
var recaptchaV2EnterpriseResult = await cmCloudClient.SolveAsync(recaptchaV2EnterpriseRequest);
Console.WriteLine("Captcha Solution: " + recaptchaV2EnterpriseResult.Solution.Value); // 输出验证码解决方案结果
}
}
ReCaptchaV2Enterprise
使用 Zennolab.CapMonsterCloud.Requests;
使用 Zennolab.CapMonsterCloud.Requests;使用 Zennolab.CapMonsterCloud.Requests
类 程序
{
static async Task Main(string[] args)
{
var clientOptions = new ClientOptions
{
ClientKey = "your_api_key" // 替换为您的 CapMonster 云 API 密钥
};
var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions);
var recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseRequest
{
WebsiteUrl = "https://example.com", // 带验证码的网站地址
WebsiteKey = "6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s", // 替换为网站密钥。
EnterprisePayload = "{\"s\":\"SOME_ADDITIONAL_TOKEN\"}", // 附加令牌(如果需要)。
ProxyType = ProxyType.Http, // 代理类型
ProxyAddress = "8.8.8.8.8", // ProxyAddress
代理服务器端口 = 8080, //代理服务器端口
代理登录 = "proxyLoginHere", // 代理登录(如需要)
代理密码 = "proxyPasswordHere" // 代理密码(如需要)
};
var recaptchaV2EnterpriseResult = await cmCloudClient.SolveAsync(recaptchaV2EnterpriseRequest);
Console.WriteLine("Captcha Solution: " + recaptchaV2EnterpriseResult.Solution.Value); // 输出验证码解决方案结果
}
}
Python。
https://github.com/ZennoLab/capmonstercloud-client-python
RecaptchaV2EnterpriseProxyless
导入 asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaV2EnterpriseProxylessRequest
client_options = ClientOptions(api_key="your_api_key") # 替换为您的 CapMonster 云 API 密钥
cap_monster_client = CapMonsterClient(options=client_options)
recaptcha2request = RecaptchaV2EnterpriseProxylessRequest(
websiteUrl="https://example.com", # 带有验证码的网站地址。
websiteKey="6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s", # 替换为您的 websiteKey。
enterprisePayload={ # 附加令牌(如需要)
{ "s":"some_additional_token".
}
)
async def solve_captcha():
返回 await cap_monster_client.solve_captcha(recaptcha2request)
responses = asyncio.run(solve_captcha())
print(responses) # 打印验证码解决方案
ReCaptchaV2Enterprise
导入 asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
从 capmonstercloudclient.requests 导入 RecaptchaV2EnterpriseRequest
client_options = ClientOptions(api_key="your_api_key") # 替换为您的 CapMonster 云 API 密钥
cap_monster_client = CapMonsterClient(options=client_options)
recaptcha2request = RecaptchaV2EnterpriseRequest(
websiteUrl="https://example.com", # 验证码网站的地址
websiteKey="6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s", # 替换为您的 websiteKey。
enterprisePayload={ # 附加令牌(如需要)
{ "s":"some_additional_token".
}、
proxy_type="http", # 代理类型(http、https、socks5)
proxy_address="8.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) # 输出验证码解决方案
JavaScript(基于浏览器)
https://github.com/ZennoLab/capmonstercloud-client-js
RecaptchaV2EnterpriseProxyless
import { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2EnterpriseProxylessRequest } from '@zennolab_com/capmonstercloud-client';
document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' })); // 替换为您的 CapMonsterCloud API 密钥
const recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseProxylessRequest({
websiteURL:'https://mydomain.com/page-with-recaptcha-enterprise', // Captcha website URL
websiteKey: '6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s', // 替换为您的 websiteKey。
enterprisePayload:{
s:'SOME_ADDITIONAL_TOKEN',// 附加令牌(如需要)
}、
});
console.log(await cmcClient.Solve(recaptchaV2EnterpriseRequest));
});
RecaptchaV2Enterprise
import { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2EnterpriseRequest } from '@zennolab_com/capmonstercloud-client';
document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' })); // 替换为您的 CapMonsterCloud API 密钥
const recaptchaV2EnterpriseRequest = new RecaptchaV2EnterpriseRequest({
websiteURL:'https://mydomain.com/page-with-recaptcha-enterprise', //带有验证码的网站地址
websiteKey: '6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s', // 替换为您的 websiteKey。
enterprisePayload:{
s:'SOME_ADDITIONAL_TOKEN',// 附加令牌(如需要)
}、
proxyType:http', //代理类型(http、https、socks5)
proxyAddress:8.8.8.8.8',// 代理服务器端口
proxyPort: 8080, // ProxyServerPort
proxyLogin:proxyLoginHere',// 代理登录(如果需要)
proxyPassword:'proxyPasswordHere', // 代理密码(如需要)
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'、
});
console.log(await cmcClient.Solve(recaptchaV2EnterpriseRequest));
});
JavaScript(使用 Node.js)
// https://github.com/ZennoLab/capmonstercloud-client-js
RecaptchaV2EnterpriseProxyless
const { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2EnterpriseProxylessRequest }.= require('@zennolab_com/capmonstercloud-client');
async function run() {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: 'your_api_key' })); // 替换为来自 CapMonsterCloud 的 API 密钥
const recaptchaRequest = new RecaptchaV2EnterpriseProxylessRequest({
websiteURL:'https://example.com/', // 包含验证码的网站地址
websiteKey: '6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s', // 替换为您的 websiteKey。
enterprisePayload:{
s:'SOME_ADDITIONAL_TOKEN', //附加令牌(如需要)
}、
});
const response = await cmcClient.Solve(recaptchaRequest);
if (!response?.solution) throw new Error('Captcha not solved.');
console.log('Captcha not solved:', response.solution);
}
run()
.then() => {
console.log('DONE');
process.exit(0);
})
.catch((err) => {
console.error(err);
process.exit(1);
});
 ;
RecaptchaV2Enterprise
const { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2EnterpriseRequest, ProxyType }= require('@zennolab_com/capmonstercloud-client');
async function run() {
const cmcClient = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: 'your_api_key' }) // 替换为您的 CapMonsterCloud API 密钥
);
const recaptchaRequest = new RecaptchaV2EnterpriseRequest({
websiteURL:'https://example.com/', //带有验证码的网站地址
websiteKey: '6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s', // 替换为您的 websiteKey。
enterprisePayload:{
s:'SOME_ADDITIONAL_TOKEN', //附加令牌(如需要)
}、
proxyType:ProxyType.Http, // 代理类型(http、https、socks5)
proxyAddress:8.8.8.8.8', // 代理服务器地址
proxyPort:8080, //代理服务器端口
proxyLogin:proxyLoginHere', //代理登录(如需要)
proxyPassword: 'proxyPasswordHere', // 代理密码(如需要)
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' // 使用最新的 UserAgent。
});
const response = await cmcClient.Solve(recaptchaRequest);
if (!response?.solution) throw new Error('Captcha not solved.');
console.log('Captcha not solved:', response.solution);
}
运行()
.then() => {
console.log('DONE');
process.exit(0);
})
.catch((err) => {
console.error(err);
process.exit(1);
});
获取和使用标记:如何将解决方案替换为页面
- 解决验证码问题并获得令牌后,使用 Selenium 查找此元素:
textarea = driver.Find_element(By.find_element(By.ID, "g-recaptcha-response")
- 许多网站隐藏 文本区域display: none),用户无法直接进行交互。在某些浏览器或 Selenium 版本中,完全隐藏的元素可能无法通过 接收数据。send_keys().打开元素使其可用于输入。但是让 textarea 可见是可选的,这一行只是在不可见元素出现问题时的额外措施:
driver.execute_script("arguments[0].style.display = 'block';", textarea)
- 使用 .send_keys:
textarea.send_keys(captcha_token)
- 单击(使用 ActionChains) 上的按钮(假设示例中的元素名为 button[data-action='demo_action']:
button = driver.find_element(By.CSS_SELECTOR, "button[data-action='demo_action']")
ActionChains(driver).move_to_element(button).click(button).perform()
或者使用自动表单提交:
driver.execute_script("document.forms[0].submit();")
- 解决 RecatchaV2EnterpriseProxyless 的完整代码:
import asyncio
导入时间
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaV2EnterpriseProxylessRequest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
# 自定义硒
driver = webdriver.Chrome()
driver.get("https://example.com") # 加载带有验证码的页面
# 配置 CapMonster 云
client_options = ClientOptions(api_key="your_api_key") # 替换为您的 API 密钥
cap_monster_client = CapMonsterClient(options=client_options)
# 获取站点密钥(可从页面获取)
website_url = driver.current_url
website_key = "6Lf56sWnAAAAAIKLuWNYgRsFUfmI-5Lex3xT5N-s" # 替换为实际网站密钥。
recaptcha_request = RecaptchaV2EnterpriseProxylessRequest(
websiteUrl=website_url、
websiteKey=website_key
)
# 验证码解决方案
async def solve_captcha():
return await cap_monster_client.solve_captcha(recaptcha_request)
responses = asyncio.run(solve_captcha())
captcha_token = responses["gRecaptchaResponse"] # 从响应中获取令牌
# 将标记插入 reCAPTCHA 元素
textarea = driver.find_element(By.ID, "g-recaptcha-response")
driver.execute_script("arguments[0].style.display = 'block';", textarea) # 使其可见
textarea.send_keys(captcha_token) # 插入令牌
# 触发更改事件并点击确认按钮
button = driver.find_element(By.CSS_SELECTOR, "button[data-action='demo_action']")
ActionChains(driver).move_to_element(button).click(button).perform()
print("The captcha has been successfully solved and submitted!")
time.sleep(5)
driver.quit()
本例是将令牌解码并替换到表单中的方法,仅供参考--在每种情况下,元素名称和方法可能会有所不同。
错误处理和性能优化
When you are working with reCAPTCHA Enterprise, it is important to understand what errors can occur and how to handle them effectively.在本节中,我们将向您介绍使用 API 时的典型错误,并分享如何提高脚本性能和稳定性的建议。所有这些都将帮助您节省时间并避免不必要的问题。
使用 API 时的典型错误以及改进流程的提示
- Invalid query parameters
通常情况下,发生错误的原因是您在查询中传递的参数不正确。例如,可能是在 sitekey、错误的 URL 或错误的令牌来解决验证码问题。为避免此类情况,请务必确保您提交的数据正确无误。
Council:
Make sure sitekeyand url 正确使用您验证码的每个页面。在符合验证码类型的查询中使用适当的参数(例如、for Enterprise 验证码可能有附加参数,例如 enterprisePayload).请阅读文档并为每个请求使用正确的参数。
- Timeout error (timeout)
有时,解决验证码所需的时间会比您预期的长一些。如果请求未能及时完成,就会出现超时错误。为避免出现这种情况,最好正确设置等待时间并允许重试。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">Council:
为您的请求设置合理的超时。
如果出现超时,请使用重试机制,以免丢失解决方案。
- API 限制和请求频率
U CapMonster Cloud 您在给定时间内可以发送的请求数量是有限制的。如果超过此限制,可能会出现性能问题甚至阻塞。为避免出现这种情况,请务必遵守限制并适当分配负载。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">Council:
注意对请求数量的限制。将请求分割成小块,以避免阻塞。
- Interactive testing and monitoring
有时,使用实时监控工具来跟踪网站的互动情况会很有帮助。这将帮助您确定错误发生的位置。
Council:
使用监控工具(例如:Chrome DevTools)、 Chrome DevTools 或内置调试器)来实时查看验证码的解决过程。
- Asynchronous Queries
如果您的脚本要同时处理多个验证码,异步查询可以大大提高性能。异步允许您避免在验证码求解时阻止其他任务运行。
Council:
尝试使用一些库,例如: asyncio 或 aiohttp 使请求异步。
因此,在我们的文章中,我们已经详细解释了什么是 reCAPTCHA Enterprise,以及它如何帮助保护网站免受自动攻击。我们解释了如何在页面上识别这种验证码,并提供了使用不同编程语言的官方 CapMonster 云库来解决验证码问题的代码示例。我们还展示了如何正确地将令牌代入表单并确认验证码解决方案。38;margin-bottom:0pt;margin-top:0pt;" dir="ltr">此外,我们还分享了优化 reCAPTCHA Enterprise 工作的实用技巧,并回顾了使用 API 时可能出现的典型错误。这些简单的建议将帮助您避免问题,使您的脚本更稳定、更快速!"
我们相信,通过遵循这些提示,您将能够有效应对与 reCAPTCHA Enterprise 自动化解决方案以及诸如 CapMonster Cloud 使整个过程更加轻松,节省时间。
NB:提醒您,该产品用于在您自己的网站和您拥有合法访问权限的网站上自动进行测试。