Tencent CAPTCHA Token Solving
Solve Tencent CAPTCHA challenges programmatically. Tencent CAPTCHA is widely used on Chinese websites and applications for bot protection.
Tencent CAPTCHA is a verification service provided by Tencent Cloud. It uses various challenge types including slider puzzles, click verification, and image selection. The solution returns a token containing ticket and randstr for verification.
Captcha Type
Use the following captcha type identifier in your API requests:
"type": "TENCENT_CAPTCHA_TOKEN"
Finding Captcha Parameters
To solve Tencent CAPTCHA, you need to find the siteKey (appId):
// Look for TencentCaptcha initialization in the page
var captcha = new TencentCaptcha('190014885', callback, options);
Request Format
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
auth.token |
string | required | Your API key |
captcha.type |
string | required | Must be "TENCENT_CAPTCHA_TOKEN" |
captcha.metadata.siteUrl |
string | required | The URL where the captcha appears |
captcha.metadata.siteKey |
string | required | Tencent CAPTCHA appId (CaptchaAppId) |
captcha.payload.proxy |
object | optional | Proxy configuration (recommended for Chinese sites) |
Example Request
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: {
token: 'YOUR_API_KEY'
},
context: {
source: 'api',
version: '1.0.0'
},
captcha: {
type: 'TENCENT_CAPTCHA_TOKEN',
metadata: {
siteUrl: 'https://www.example.com/',
siteKey: '190014885'
},
payload: {}
}
})
});
const data = await response.json();
console.log('Task ID:', data.task.id);
Response Format
Create Task Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Task created successfully",
"task": {
"id": "MyDisctSolver_abc123",
"status": "processing"
}
}
Fetch Result Response (Completed)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_abc123",
"status": "completed",
"result": {
"token": "{"ticket":"tr0344YjJASGmJGtohyWS_y6tJKiqVPIdFgl87vWlVaQoueR8D6DH28go-i-VjeassM31SXO7D0*","randstr":"@KVN"}",
"timestamp": "2025-11-26T12:00:15.000Z"
}
}
}
The token field contains a JSON string with ticket and randstr values.
Parse this JSON and pass these values to the callback function or backend verification.
Implementation Guide
Step 1: Extract siteKey from Page
// Find TencentCaptcha initialization
function getTencentSiteKey() {
const scripts = document.querySelectorAll('script');
for (const script of scripts) {
const match = script.textContent.match(/new\s+TencentCaptcha\s*\(\s*['"](\d+)['"]/);
if (match) {
return match[1];
}
}
return null;
}
const siteKey = getTencentSiteKey();
console.log('Tencent siteKey:', siteKey);
Step 2: Parse and Use the Token
// After solving, parse the token
const tokenData = JSON.parse(result.token);
myCallbackFunction({
ret: 0,
ticket: tokenData.ticket,
randstr: tokenData.randstr,
appid: siteKey
});
await fetch('/api/verify-captcha', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
ticket: tokenData.ticket,
randstr: tokenData.randstr,
appid: siteKey
})
});
Python Example
import requests
import time
import json
def solve_tencent_captcha(site_url, site_key, api_key, proxy=None):
payload = {}
if proxy:
payload['proxy'] = proxy
# Step 1: Create task
create_response = requests.post(
'https://solver-api.mydisct.com/createTask',
headers={
'Content-Type': 'application/json',
'apikey': api_key
},
json={
'auth': {'token': api_key},
'context': {'source': 'api', 'version': '1.0.0'},
'captcha': {
'type': 'TENCENT_CAPTCHA_TOKEN',
'metadata': {
'siteUrl': site_url,
'siteKey': site_key
},
'payload': payload
}
}
)
create_data = create_response.json()
if not create_data['success']:
raise Exception(create_data['error']['message'])
task_id = create_data['task']['id']
# Step 2: Poll for result
while True:
time.sleep(5)
result_response = requests.post(
'https://solver-api.mydisct.com/fetchResult',
headers={'Content-Type': 'application/json', 'apikey': api_key},
json={'taskId': task_id}
)
result_data = result_response.json()
if result_data['task']['status'] == 'completed':
return result_data['task']['result']['token']
elif result_data['task']['status'] == 'failed':
raise Exception('Solving failed')
# Usage
token = solve_tencent_captcha(
site_url='https://www.example.com/',
site_key='190014885',
api_key='YOUR_API_KEY'
)
# Parse the token
token_data = json.loads(token)
print(f'Ticket: {token_data["ticket"]}')
print(f'Randstr: {token_data["randstr"]}')
# Submit with the token
response = requests.post('https://www.example.com/api/verify', json={
'ticket': token_data['ticket'],
'randstr': token_data['randstr'],
'appid': '190014885'
})
Best Practices
- Make sure to extract the correct siteKey (appId) from the TencentCaptcha initialization
- Consider using a Chinese proxy for better success rates on Chinese websites
- Parse the token JSON to get ticket and randstr values
- Tencent tokens expire after a few minutes, use them promptly
Common Issues
Solution: The siteKey (appId) must be a numeric string (e.g., "190014885"). Make sure you're extracting the correct value from the TencentCaptcha constructor call in the page source.
Solution: Ensure you're parsing the token JSON and sending both ticket and randstr values. Some backends also require the user's IP address to match.
Solution: For websites hosted in China, using a Chinese proxy can significantly improve solving speed and success rate.