TenDI - 腾讯验证码
更多相关内容,请访问我们的博客
注意!
此任务将使用我们的代理服务器执行。
请求参数
type
<string>requiredCustomTask
class
<string>requiredTenDI
websiteURL
<string>required解决验证码的主页地址。
websiteKey
<string>requiredcaptchaAppId。例如 "websiteKey": "189123456"
- 是您网站的唯一参数。您可以从带有验证码的HTML页面或流量中获取它(参见下面的描述)。
userAgent
<string>optional浏览器用户代理。只传递 Windows 操作系统的实际 UA。现在是版本: userAgentPlaceholder
proxyType
<string>optionalhttp - 普通的 http/https 代理;
https - 仅在 "http" 不起作用时尝试(某些自定义代理服务器要求);
socks4 - socks4 代理;
socks5 - socks5 代 理。
proxyAddress
<string>optional代理 IP 地址 IPv4/IPv6。不允许:
- 使用主机名;
- 使用透明代理(其中客户端 IP 可见);
- 使用来自本地网络的代理。
proxyPort
<integer>optional代理端口。
proxyLogin
<string>optional代理登录。
proxyPassword
<string>optional代理密码。
如何获取网站密钥(captchaAppId)
打开开发者工具,转到网络标签,激活验证码并查看请求。其中一些将包含您需要的参数值。在这种情况下,websiteKey=aid
创建任务方法
POST
https://api.capmonster.cloud/createTask
要求
{
"clientKey": "API_KEY",
"task": {
"type": "CustomTask",
"class": "TenDI",
"websiteURL": "https://example.com",
"websiteKey": "189123456",
"userAgent": "userAgentPlaceholder"
}
}
回应
{
"errorId":0,
"taskId":407533072
}
获取任务结果方法
使用getTaskResult方法获取TenDI的解决方案。
POST
https://api.capmonster.cloud/getTaskResult
要求
{
"clientKey":"API_KEY",
"taskId": 407533072
}
回应
{
"errorId":0,
"status":"ready",
"solution": {
"data": {
"randstr": "@EcL",
"ticket": "tr03lHUhdnuW3neJZu.....7LrIbs*"
},
"headers": {
"User-Agent": "userAgentPlaceholder"
}
}
}
使用 SDK 库
- JavaScript
- Python
- C#
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, TenDIRequest } 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 tenDIRequest = new TenDIRequest({
websiteURL: 'https://example.com',
websiteKey: 'websiteKey',
});
console.log(await cmcClient.Solve(tenDIRequest));
});
# https://github.com/ZennoLab/capmonstercloud-client-python
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import TenDiCustomTaskProxylessRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonster Cloud API key
cap_monster_client = CapMonsterClient(options=client_options)
ten_di_request = TenDiCustomTaskProxylessRequest(
websiteUrl="https://example.com", # URL with the captcha
websiteKey="189956587", # Replace with the website key for the captcha
userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36" # Use the current userAgent
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(ten_di_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 tenDiRequest = new TenDiCustomTaskProxylessRequest
{
WebsiteUrl = "https://example.com", // URL with the captcha
WebsiteKey = "189956587", // Replace with the correct website key
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36" // Use the current userAgent
};
var tenDiRequestResult = await cmCloudClient.SolveAsync(tenDiRequest);
Console.WriteLine("Captcha Solution: " + string.Join(", ", tenDiRequestResult.Solution.Data));
Console.WriteLine("Captcha Solution: " + string.Join(", ", tenDiRequestResult.Solution.Headers));
}
}