0
# Emerging Captchas
1
2
Methods for solving newer and region-specific captcha systems including Tencent, CutCaptcha, DataDome, CyberSiARA, and Yandex Smart captchas.
3
4
## Capabilities
5
6
### Tencent Captcha
7
8
Solves Tencent captcha challenges commonly used in Chinese websites and applications.
9
10
```python { .api }
11
def tencent(self, app_id, url, **kwargs):
12
"""
13
Solve Tencent captcha challenges.
14
15
Parameters:
16
- app_id (str): Tencent application ID (required)
17
- url (str): Full URL where Tencent captcha is located (required)
18
- softId (int): Software developer ID
19
- callback (str): Pingback URL for result notification
20
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
21
22
Returns:
23
dict: {'captchaId': str, 'code': str} - code contains Tencent captcha solution
24
"""
25
```
26
27
### CutCaptcha
28
29
Solves CutCaptcha challenges that involve sliding or fitting puzzle pieces.
30
31
```python { .api }
32
def cutcaptcha(self, misery_key, apikey, url, **kwargs):
33
"""
34
Solve CutCaptcha challenges.
35
36
Parameters:
37
- misery_key (str): CutCaptcha misery key parameter (required)
38
- apikey (str): CutCaptcha API key parameter (required)
39
- url (str): Full URL where CutCaptcha is located (required)
40
- softId (int): Software developer ID
41
- callback (str): Pingback URL for result notification
42
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
43
44
Returns:
45
dict: {'captchaId': str, 'code': str} - code contains CutCaptcha solution
46
"""
47
```
48
49
### DataDome Captcha
50
51
Solves DataDome bot protection captcha challenges.
52
53
```python { .api }
54
def datadome(self, captcha_url, pageurl, userAgent, proxy, **kwargs):
55
"""
56
Solve DataDome Captcha challenges.
57
58
Parameters:
59
- captcha_url (str): URL to the DataDome captcha page (required)
60
- pageurl (str): URL of the original page being protected (required)
61
- userAgent (str): User agent string that triggered the captcha (required)
62
- proxy (dict): Proxy configuration (required) {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
63
64
Returns:
65
dict: {'captchaId': str, 'code': str} - code contains DataDome solution cookie
66
"""
67
```
68
69
### CyberSiARA
70
71
Solves CyberSiARA captcha challenges.
72
73
```python { .api }
74
def cybersiara(self, master_url_id, pageurl, userAgent, **kwargs):
75
"""
76
Solve CyberSiARA captcha challenges.
77
78
Parameters:
79
- master_url_id (str): CyberSiARA master URL ID (required)
80
- pageurl (str): URL of the page with CyberSiARA captcha (required)
81
- userAgent (str): User agent string for browser simulation (required)
82
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
83
84
Returns:
85
dict: {'captchaId': str, 'code': str} - code contains CyberSiARA solution
86
"""
87
```
88
89
### Yandex Smart Captcha
90
91
Solves Yandex Smart Captcha challenges used on Russian websites.
92
93
```python { .api }
94
def yandex_smart(self, sitekey, url, **kwargs):
95
"""
96
Solve Yandex Smart Captcha challenges.
97
98
Parameters:
99
- sitekey (str): Yandex Smart Captcha sitekey (required)
100
- url (str): Full URL where Yandex captcha is located (required)
101
- softId (int): Software developer ID
102
- callback (str): Pingback URL for result notification
103
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
104
- userAgent (str): User agent string for browser simulation
105
106
Returns:
107
dict: {'captchaId': str, 'code': str} - code contains Yandex Smart Captcha token
108
"""
109
```
110
111
## Usage Examples
112
113
### Tencent Captcha
114
115
```python
116
from twocaptcha import TwoCaptcha
117
118
solver = TwoCaptcha('your_api_key')
119
120
# Solve Tencent captcha
121
result = solver.tencent(
122
app_id='tencent_app_id',
123
url='https://chinese-site.com/login'
124
)
125
print(f"Tencent solution: {result['code']}")
126
127
# With proxy for geographic access
128
result = solver.tencent(
129
app_id='app_123',
130
url='https://qq.com/form',
131
proxy={'type': 'HTTPS', 'uri': 'user:pass@china-proxy.com:8080'}
132
)
133
print(f"Solution: {result['code']}")
134
```
135
136
### CutCaptcha
137
138
```python
139
from twocaptcha import TwoCaptcha
140
141
solver = TwoCaptcha('your_api_key')
142
143
# Solve CutCaptcha puzzle
144
result = solver.cutcaptcha(
145
misery_key='cutcaptcha_misery_key',
146
apikey='cutcaptcha_api_key',
147
url='https://example.com/cutcaptcha-form'
148
)
149
print(f"CutCaptcha solution: {result['code']}")
150
151
# With proxy support
152
result = solver.cutcaptcha(
153
misery_key='misery_123',
154
apikey='api_456',
155
url='https://secure-site.com',
156
proxy={'type': 'HTTPS', 'uri': 'proxy_user:proxy_pass@proxy.com:3128'}
157
)
158
print(f"Solution: {result['code']}")
159
```
160
161
### DataDome Captcha
162
163
```python
164
from twocaptcha import TwoCaptcha
165
166
solver = TwoCaptcha('your_api_key')
167
168
# Solve DataDome captcha (requires all parameters)
169
result = solver.datadome(
170
captcha_url='https://geo.captcha-delivery.com/captcha/?initialCid=...',
171
pageurl='https://protected-site.com/page',
172
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
173
proxy={'type': 'HTTPS', 'uri': 'user:pass@proxy.com:8080'}
174
)
175
print(f"DataDome cookie: {result['code']}")
176
```
177
178
### CyberSiARA
179
180
```python
181
from twocaptcha import TwoCaptcha
182
183
solver = TwoCaptcha('your_api_key')
184
185
# Solve CyberSiARA captcha
186
result = solver.cybersiara(
187
master_url_id='cybersiara_master_id',
188
pageurl='https://example.com/cybersiara-page',
189
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
190
)
191
print(f"CyberSiARA solution: {result['code']}")
192
193
# With proxy
194
result = solver.cybersiara(
195
master_url_id='master_123',
196
pageurl='https://protected.com',
197
userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
198
proxy={'type': 'HTTPS', 'uri': 'user:pass@proxy.com:8080'}
199
)
200
print(f"Solution: {result['code']}")
201
```
202
203
### Yandex Smart Captcha
204
205
```python
206
from twocaptcha import TwoCaptcha
207
208
solver = TwoCaptcha('your_api_key')
209
210
# Solve Yandex Smart Captcha
211
result = solver.yandex_smart(
212
sitekey='yandex_sitekey',
213
url='https://yandex.ru/form'
214
)
215
print(f"Yandex token: {result['code']}")
216
217
# With custom user agent and proxy
218
result = solver.yandex_smart(
219
sitekey='sitekey_value',
220
url='https://russian-site.ru',
221
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0',
222
proxy={'type': 'HTTPS', 'uri': 'user:pass@russia-proxy.com:8080'}
223
)
224
print(f"Token: {result['code']}")
225
```
226
227
### Real-World Integration Example
228
229
```python
230
from twocaptcha import TwoCaptcha
231
import requests
232
import json
233
234
solver = TwoCaptcha('your_api_key')
235
236
def solve_datadome_protected_site():
237
"""Example of solving DataDome protection on a real site"""
238
239
# Step 1: Make initial request that triggers DataDome
240
session = requests.Session()
241
session.headers.update({
242
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
243
})
244
245
try:
246
response = session.get('https://protected-site.com/data')
247
248
# Check if DataDome captcha is triggered
249
if 'geo.captcha-delivery.com' in response.url:
250
print("DataDome captcha detected")
251
252
# Extract captcha URL
253
captcha_url = response.url
254
original_url = 'https://protected-site.com/data'
255
256
# Solve captcha
257
result = solver.datadome(
258
captcha_url=captcha_url,
259
pageurl=original_url,
260
userAgent=session.headers['User-Agent'],
261
proxy={'type': 'HTTPS', 'uri': 'user:pass@proxy.com:8080'}
262
)
263
264
# Use the solution cookie
265
datadome_cookie = result['code']
266
session.cookies.set('datadome', datadome_cookie)
267
268
# Retry original request
269
response = session.get(original_url)
270
print(f"Request successful: {response.status_code}")
271
return response.json()
272
273
except Exception as e:
274
print(f"Error: {e}")
275
return None
276
277
# Usage
278
data = solve_datadome_protected_site()
279
if data:
280
print("Successfully bypassed DataDome protection")
281
```
282
283
### Error Handling for Emerging Captchas
284
285
```python
286
from twocaptcha import TwoCaptcha, ValidationException, ApiException
287
288
solver = TwoCaptcha('your_api_key')
289
290
# Handle validation errors for required parameters
291
try:
292
result = solver.datadome(
293
captcha_url='', # Empty required parameter
294
pageurl='https://example.com',
295
userAgent='Mozilla/5.0...',
296
proxy={'type': 'HTTPS', 'uri': 'proxy:8080'}
297
)
298
except ValidationException as e:
299
print(f"Missing required parameter: {e}")
300
301
# Handle regional captcha errors
302
try:
303
result = solver.tencent(
304
app_id='invalid_app_id',
305
url='https://chinese-site.com'
306
)
307
except ApiException as e:
308
if 'INVALID_APP_ID' in str(e):
309
print("Tencent app ID is invalid")
310
elif 'REGION_BLOCKED' in str(e):
311
print("Service blocked in this region, try using a proxy")
312
else:
313
print(f"API error: {e}")
314
315
# Handle geographic restrictions
316
try:
317
result = solver.yandex_smart(
318
sitekey='yandex_key',
319
url='https://yandex.ru/form'
320
)
321
except ApiException as e:
322
if 'GEO_RESTRICTED' in str(e):
323
print("Yandex captcha requires Russian IP address")
324
# Retry with Russian proxy
325
result = solver.yandex_smart(
326
sitekey='yandex_key',
327
url='https://yandex.ru/form',
328
proxy={'type': 'HTTPS', 'uri': 'user:pass@russian-proxy.com:8080'}
329
)
330
print(f"Solved with proxy: {result['code']}")
331
```
332
333
### Performance Tips for Emerging Captchas
334
335
```python
336
from twocaptcha import TwoCaptcha
337
import time
338
339
solver = TwoCaptcha('your_api_key')
340
341
# Regional captchas may take longer, increase timeouts
342
solver_extended = TwoCaptcha(
343
'your_api_key',
344
defaultTimeout=300, # 5 minutes for regional captchas
345
pollingInterval=15 # Check less frequently
346
)
347
348
# Batch solving for multiple regions
349
regional_captchas = [
350
('tencent', {'app_id': 'app1', 'url': 'https://site1.cn'}),
351
('yandex_smart', {'sitekey': 'key1', 'url': 'https://site1.ru'}),
352
('cutcaptcha', {'misery_key': 'mk1', 'apikey': 'ak1', 'url': 'https://site1.com'})
353
]
354
355
for captcha_type, params in regional_captchas:
356
try:
357
method = getattr(solver_extended, captcha_type)
358
result = method(**params)
359
print(f"{captcha_type} solved: {result['code']}")
360
except Exception as e:
361
print(f"Failed {captcha_type}: {e}")
362
continue
363
```