0
# Specialized Captchas
1
2
Methods for solving specialized captcha systems including KeyCaptcha, Capy, Lemin, ATB, and various other proprietary captcha solutions.
3
4
## Capabilities
5
6
### KeyCaptcha
7
8
Solves KeyCaptcha puzzle challenges that require assembling key pieces.
9
10
```python { .api }
11
def keycaptcha(self, s_s_c_user_id, s_s_c_session_id,
12
s_s_c_web_server_sign, s_s_c_web_server_sign2,
13
url, **kwargs):
14
"""
15
Solve KeyCaptcha challenges.
16
17
Parameters:
18
- s_s_c_user_id (str): Value of s_s_c_user_id parameter (required)
19
- s_s_c_session_id (str): Value of s_s_c_session_id parameter (required)
20
- s_s_c_web_server_sign (str): Value of s_s_c_web_server_sign parameter (required)
21
- s_s_c_web_server_sign2 (str): Value of s_s_c_web_server_sign2 parameter (required)
22
- url (str): Full URL where KeyCaptcha is located (required)
23
- softId (int): Software developer ID
24
- callback (str): Pingback URL for result notification
25
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
26
27
Returns:
28
dict: {'captchaId': str, 'code': str} - code contains KeyCaptcha solution
29
"""
30
```
31
32
### CapyPuzzle
33
34
Solves Capy Puzzle captcha challenges.
35
36
```python { .api }
37
def capy(self, sitekey, url, **kwargs):
38
"""
39
Solve Capy Puzzle captcha.
40
41
Parameters:
42
- sitekey (str): Value of sitekey parameter (required)
43
- url (str): Full URL where Capy captcha is located (required)
44
- api_server (str): API server URL if different from default
45
- version (str): Capy version if specified
46
- softId (int): Software developer ID
47
- callback (str): Pingback URL for result notification
48
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
49
50
Returns:
51
dict: {'captchaId': str, 'code': str} - code contains Capy solution
52
"""
53
```
54
55
### Lemin Cropped Captcha
56
57
Solves Lemin Cropped Captcha challenges.
58
59
```python { .api }
60
def lemin(self, captchaId, div_id, url, **kwargs):
61
"""
62
Solve Lemin Cropped Captcha.
63
64
Parameters:
65
- captchaId (str): Value of captchaId parameter (required)
66
- div_id (str): Value of div_id parameter (required)
67
- url (str): Full URL where Lemin captcha is located (required)
68
- api_server (str): API server URL if specified
69
- softId (int): Software developer ID
70
- callback (str): Pingback URL for result notification
71
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
72
73
Returns:
74
dict: {'captchaId': str, 'code': str} - code contains Lemin solution
75
"""
76
```
77
78
### atbCAPTCHA
79
80
Solves atbCAPTCHA challenges.
81
82
```python { .api }
83
def atb_captcha(self, app_id, api_server, url, **kwargs):
84
"""
85
Solve atbCAPTCHA challenges.
86
87
Parameters:
88
- app_id (str): Application ID for atbCAPTCHA (required)
89
- api_server (str): atbCAPTCHA API server URL (required)
90
- url (str): Full URL where atbCAPTCHA is located (required)
91
- proxy (dict): Proxy configuration {'type': 'HTTPS', 'uri': 'login:pass@ip:port'}
92
93
Returns:
94
dict: {'captchaId': str, 'code': str} - code contains atbCAPTCHA solution
95
"""
96
```
97
98
## Usage Examples
99
100
### KeyCaptcha
101
102
```python
103
from twocaptcha import TwoCaptcha
104
105
solver = TwoCaptcha('your_api_key')
106
107
# Extract KeyCaptcha parameters from the page
108
result = solver.keycaptcha(
109
s_s_c_user_id='12345',
110
s_s_c_session_id='session_id_value',
111
s_s_c_web_server_sign='server_sign_value',
112
s_s_c_web_server_sign2='server_sign2_value',
113
url='https://example.com/keycaptcha-page'
114
)
115
print(f"KeyCaptcha solution: {result['code']}")
116
117
# With proxy support
118
result = solver.keycaptcha(
119
s_s_c_user_id='12345',
120
s_s_c_session_id='session_id',
121
s_s_c_web_server_sign='sign1',
122
s_s_c_web_server_sign2='sign2',
123
url='https://secure-site.com',
124
proxy={'type': 'HTTPS', 'uri': 'user:pass@proxy.com:8080'}
125
)
126
print(f"Solution: {result['code']}")
127
```
128
129
### Capy Puzzle
130
131
```python
132
from twocaptcha import TwoCaptcha
133
134
solver = TwoCaptcha('your_api_key')
135
136
# Basic Capy captcha
137
result = solver.capy(
138
sitekey='capy_site_key',
139
url='https://example.com/capy-form'
140
)
141
print(f"Capy solution: {result['code']}")
142
143
# With custom API server and version
144
result = solver.capy(
145
sitekey='capy_site_key',
146
url='https://example.com/form',
147
api_server='https://api.capy.me',
148
version='1.0'
149
)
150
print(f"Solution: {result['code']}")
151
```
152
153
### Lemin Cropped Captcha
154
155
```python
156
from twocaptcha import TwoCaptcha
157
158
solver = TwoCaptcha('your_api_key')
159
160
# Solve Lemin captcha
161
result = solver.lemin(
162
captchaId='lemin_captchaId',
163
div_id='lemin_div_id',
164
url='https://example.com/lemin-captcha'
165
)
166
print(f"Lemin solution: {result['code']}")
167
168
# With custom API server
169
result = solver.lemin(
170
captchaId='captcha_123',
171
div_id='div_456',
172
url='https://site.com',
173
api_server='https://api.lemin.me'
174
)
175
print(f"Solution: {result['code']}")
176
```
177
178
### atbCAPTCHA
179
180
```python
181
from twocaptcha import TwoCaptcha
182
183
solver = TwoCaptcha('your_api_key')
184
185
# Solve atbCAPTCHA
186
result = solver.atb_captcha(
187
app_id='atb_app_id',
188
api_server='https://api.atb-captcha.com',
189
url='https://example.com/atb-form'
190
)
191
print(f"atbCAPTCHA solution: {result['code']}")
192
193
# With proxy
194
result = solver.atb_captcha(
195
app_id='app_123',
196
api_server='https://api.atb.com',
197
url='https://secure-form.com',
198
proxy={'type': 'HTTPS', 'uri': 'proxy_user:proxy_pass@proxy.com:3128'}
199
)
200
print(f"Solution: {result['code']}")
201
```
202
203
### Error Handling for Specialized Captchas
204
205
```python
206
from twocaptcha import TwoCaptcha, ValidationException, ApiException
207
208
solver = TwoCaptcha('your_api_key')
209
210
try:
211
# Missing required parameter
212
result = solver.keycaptcha(
213
s_s_c_user_id='123',
214
s_s_c_session_id='', # Empty required parameter
215
s_s_c_web_server_sign='sign1',
216
s_s_c_web_server_sign2='sign2',
217
url='https://example.com'
218
)
219
except ValidationException as e:
220
print(f"Validation error: {e}")
221
222
try:
223
# Invalid captcha parameters
224
result = solver.capy(
225
sitekey='invalid_key',
226
url='https://example.com'
227
)
228
except ApiException as e:
229
print(f"API error: {e}")
230
```
231
232
### Integration Example
233
234
```python
235
from twocaptcha import TwoCaptcha
236
import requests
237
from selenium import webdriver
238
239
# Setup
240
solver = TwoCaptcha('your_api_key')
241
driver = webdriver.Chrome()
242
243
try:
244
# Navigate to page with KeyCaptcha
245
driver.get('https://example.com/keycaptcha-form')
246
247
# Extract KeyCaptcha parameters from page
248
user_id = driver.execute_script("return window.s_s_c_user_id;")
249
session_id = driver.execute_script("return window.s_s_c_session_id;")
250
sign1 = driver.execute_script("return window.s_s_c_web_server_sign;")
251
sign2 = driver.execute_script("return window.s_s_c_web_server_sign2;")
252
253
# Solve captcha
254
result = solver.keycaptcha(
255
s_s_c_user_id=user_id,
256
s_s_c_session_id=session_id,
257
s_s_c_web_server_sign=sign1,
258
s_s_c_web_server_sign2=sign2,
259
url=driver.current_url
260
)
261
262
# Use solution in form
263
driver.execute_script(f"document.keycaptcha_response = '{result['code']}';")
264
print(f"KeyCaptcha solved: {result['code']}")
265
266
finally:
267
driver.quit()
268
```