验证码解决方案
验证码解决方案
在使用我们的采集浏览器时,难免会遇到需要解决的风险控制验证码。这些验证码可能会影响您的自动化任务。但请放心,我们将协助您解决这一问题。
自定义CDP功能
若遇到风险控制验证码,您需要通过CDP命令通知我们。收到指令后,我们将协助完成验证码破解。您只需发送CDP命令:Captchas.automaticSolver 并附上需要破解的验证码类型即可。
自动验证码破解功能
您只需在可能出现验证码的代码部分添加以下代码片段,通过CDP命令告知我们需要破解的验证码类型,我们将立即协助处理。
const page = await page.newPage();
await page.goto('https://example.com'); res = driver.execute_cdp_cmd("Captchas.automaticSolver", {
"timeout": 120000, # Please allow sufficient time, and 2 minutes is recommended.
"solverType": "cloudflare"
})
print(f"Captchas solver result: {res}")示例说明
const puppeteer = require('puppeteer-core');
const Target_URL = "https://example.com";
const wsUrl = 'wss://{AUTH}@ws-browser.thordata.com'; //Your credentials
async function run(){
// connect browser
const browser = await puppeteer.connect({
browserWSEndpoint: wsUrl,
});
try{
console.log("Connected to browser...");
// Create a new page
const page = await browser.newPage();
// Go to target site
await page.goto(Target_URL, { waitUntil: "networkidle0" });
// Obtain the CDP client and send a custom CDP protocol
const client = await page.createCDPSession();
try {
const res = await client.send('Captchas.automaticSolver',{
"timeout": 120000, // Please allow sufficient time, and 2 minutes is recommended.
"solverType": "cloudflare" // Use the corresponding type.
});
// {message: 'Solver meaages', success: true, timestamp: 170000000}
console.log("res=", res)
} catch(e) {
console.error("err=", e)
}
// Verification
await page.screenshot({ path: 'solver_cf.png'});
const title = await page.title();
console.log("title=", title);
} catch (error) {
console.error(error);
}
finally{
console.info("browser closed")
await browser.close();
}
}
run();参数规范
发送CDP命令时,必须包含 solverType 参数。
统一返回结构
无论您使用我们的验证码解决方案破解何种类型的验证码,其返回结构均保持一致。
Last updated
Was this helpful?