TenDI - Tencent captcha
This task will be performed using our proxy servers.
Request parameters
type
<string>requiredCustomTask
class
<string>requiredTenDI
websiteURL
<string>requiredThe address of the main page where the captcha is solved.
websiteKey
<string>requiredcaptchaAppId. For example "websiteKey": "189123456"
- is a unique parameter for your site. You can take it from an html page with a captcha or from traffic (see description below).
metadata.captchaUrl
<string>optionalLink to the captcha script. It usually ends with TCaptcha.js
or TCaptcha-global.js
. You can find it in the list of requests (see example below).
userAgent
<string>optionalBrowser User-Agent. Pass only the actual UA from Windows OS. Now this is version: userAgentPlaceholder
proxyType
<string>optionalhttp - 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>optionalIPv4/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>optionalProxy port.
proxyLogin
<string>optionalProxy-server login.
proxyPassword
<string>optionalProxy-server password.
How to get websiteKey (captchaAppId)
Turn on the Developer Tools, go to the Network tab, activate the captcha and look at the requests. Some of them will contain the parameter value you need. In this case websiteKey=aid
How to get captchaUrl
Open Developer Tools, go to the Network tab, trigger the captcha, and inspect the network requests. Among them, you will find TCaptcha.js
or TCaptcha-global.js
, where you can find a link like this:
Create task method
https://api.capmonster.cloud/createTask
Request
{
"clientKey": "API_KEY",
"task": {
"type": "CustomTask",
"class": "TenDI",
"websiteURL": "https://example.com",
"websiteKey": "189123456",
"userAgent": "userAgentPlaceholder"
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Get task result method
Use the getTaskResult method to get the TenDI solution.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"data": {
"randstr": "@EcL",
"ticket": "tr03lHUhdnuW3neJZu.....7LrIbs*"
},
"headers": {
"User-Agent": "userAgentPlaceholder"
}
}
}
How to Find All Required Parameters for Task Creation
Automatically
A convenient way to automate the search for all necessary parameters. Some parameters are regenerated every time the page loads, so you'll need to extract them through a browser — either regular or headless (e.g., using Playwright). Since the values of dynamic parameters are short-lived, the captcha must be solved immediately after retrieving them.
The code snippets provided are basic examples for familiarization with extracting the required parameters. The exact implementation will depend on your captcha page, its structure, and the HTML elements/selectors it uses.
- JavaScript
- Python
- C#
Show code (Node.js)
import { chromium } from "playwright";
(async () => {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
// Intercept requests
page.on("request", (request) => {
const url = request.url();
if (
url.startsWith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid=")
) {
const parsedUrl = new URL(url);
const aid = parsedUrl.searchParams.get("aid");
console.log("Extracted aid:", aid);
}
});
await page.goto("https://www.example.com/", { waitUntil: "load" });
await page.waitForTimeout(5000);
await browser.close();
})();
Show code
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
# Intercept requests
page.on("request", lambda request: handle_request(request))
await page.goto("https://www.example.com/", wait_until="load")
await asyncio.sleep(5)
await browser.close()
def handle_request(request):
url = request.url
if url.startswith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid="):
parsed_url = request.url.split('?')[1]
params = dict(param.split('=') for param in parsed_url.split('&') if '=' in param)
aid = params.get('aid')
print("Extracted aid:", aid)
asyncio.run(main())
Show code
using System;
using System.Threading.Tasks;
using Microsoft.Playwright;
class Program
{
public static async Task Main()
{
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions {
Headless = false });
var page = await browser.NewPageAsync();
// Intercept requests
page.Request += (_, request) =>
{
var url = request.Url;
if (url.StartsWith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid="))
{
var uri = new Uri(url);
var queryParams = System.Web.HttpUtility.ParseQueryString(uri.Query);
var aid = queryParams.Get("aid");
Console.WriteLine("Extracted aid: " + aid);
}
};
await page.GotoAsync("https://www.example.com/", new PageGotoOptions {
WaitUntil = WaitUntilState.Load });
await Task.Delay(5000);
await browser.CloseAsync();
}
}
Use SDK Library
- 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));
}
}