ruby-2captcha 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec_status +16 -7
- data/.ruby-version +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +403 -66
- data/README.ru.md +416 -76
- data/api_2captcha.gemspec +4 -1
- data/examples/alibaba_example.rb +16 -0
- data/examples/altcha_example.rb +12 -0
- data/examples/amazon_waf_example.rb +14 -0
- data/examples/atb_captcha_example.rb +11 -0
- data/examples/audio_example.rb +10 -0
- data/examples/basilisk_example.rb +15 -0
- data/examples/binance_example.rb +17 -0
- data/examples/canvas_example.rb +13 -0
- data/examples/captchafox_example.rb +20 -0
- data/examples/capy_example.rb +11 -0
- data/examples/cloudflare_turnstile_example.rb +15 -0
- data/examples/coordinates_example.rb +12 -0
- data/examples/cut_captcha_example.rb +11 -0
- data/examples/cyber_siara_example.rb +10 -0
- data/examples/datadome_example.rb +12 -0
- data/examples/drag_drop_example.rb +24 -0
- data/examples/friendly_captcha_example.rb +10 -0
- data/examples/funcaptcha_example.rb +10 -0
- data/examples/geetest_example.rb +12 -0
- data/examples/geetest_v4_example.rb +10 -0
- data/examples/grid_captcha_example.rb +14 -0
- data/examples/hcaptcha_example.rb +10 -0
- data/examples/hunt_example.rb +17 -0
- data/examples/key_captcha_example.rb +13 -0
- data/examples/lemin_example.rb +12 -0
- data/examples/media/drag_drop/background.jpeg +0 -0
- data/examples/media/drag_drop/image1.jpeg +0 -0
- data/examples/media/drag_drop/image2.jpeg +0 -0
- data/examples/media/example.mp3 +0 -0
- data/examples/media/normal_2.jpg +0 -0
- data/examples/media/recaptchaGrid4x4.jpg +0 -0
- data/examples/media/recaptchaGridImginstructions4x4.jpg +0 -0
- data/examples/media/temu/body.png +0 -0
- data/examples/media/temu/part1.png +0 -0
- data/examples/media/temu/part2.png +0 -0
- data/examples/media/temu/part3.png +0 -0
- data/examples/mt_captcha_example.rb +10 -0
- data/examples/normal_captcha_example.rb +11 -0
- data/examples/prosopo_example.rb +16 -0
- data/examples/recaptcha_v2_example.rb +10 -0
- data/examples/recaptcha_v3_example.rb +18 -0
- data/examples/rotate_example.rb +13 -0
- data/examples/temu_example.rb +28 -0
- data/examples/tencent_example.rb +10 -0
- data/examples/text_example.rb +10 -0
- data/examples/tspd_example.rb +19 -0
- data/examples/vkcaptcha_example.ru +10 -0
- data/examples/vkimage_example.rb +10 -0
- data/examples/yandex_example.rb +10 -0
- data/examples/yidun_example.rb +15 -0
- data/howto.txt +8 -0
- data/lib/api_2captcha/client.rb +77 -5
- data/lib/api_2captcha/version.rb +1 -1
- metadata +62 -7
data/README.md
CHANGED
|
@@ -1,44 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://github.com/2captcha/2captcha-python"><img src="https://github.com/user-attachments/assets/37e1d860-033b-4cf3-a158-468fc6b4debc" width="82" height="30"></a>
|
|
2
|
+
<a href="https://github.com/2captcha/2captcha-javascript"><img src="https://github.com/user-attachments/assets/4d3b4541-34b2-4ed2-a687-d694ce67e5a6" width="36" height="30"></a>
|
|
3
|
+
<a href="https://github.com/2captcha/2captcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
|
|
4
|
+
<a href="https://github.com/2captcha/2captcha-ruby"><img src="https://github.com/user-attachments/assets/1c3b6dc2-9acd-44fe-927d-31de3427639f" width="75" height="30"></a>
|
|
5
|
+
<a href="https://github.com/2captcha/2captcha-cpp"><img src="https://github.com/user-attachments/assets/36de8512-acfd-44fb-bb1f-b7c793a3f926" width="45" height="30"></a>
|
|
6
|
+
<a href="https://github.com/2captcha/2captcha-php"><img src="https://github.com/user-attachments/assets/e8797843-3f61-4fa9-a155-ab0b21fb3858" width="52" height="30"></a>
|
|
7
|
+
<a href="https://github.com/2captcha/2captcha-java"><img src="https://github.com/user-attachments/assets/a3d923f6-4fec-4c07-ac50-e20da6370911" width="50" height="30"></a>
|
|
8
|
+
<a href="https://github.com/2captcha/2captcha-csharp"><img src="https://github.com/user-attachments/assets/f4d449de-780b-49ed-bb0a-b70c82ec4b32" width="38" height="30"></a>
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
# Ruby 2Captcha API Client (captcha solver)
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
12
|
+
This is the easiest way to quickly integrate [2Captcha] into your code and automate solving of any type of captcha.
|
|
13
|
+
Examples of API requests for different captcha types are available on the [Ruby captcha solver](https://2captcha.com/lang/ruby) page.
|
|
14
|
+
|
|
15
|
+
- [Ruby 2Captcha API Client (captcha solver)](#ruby-2captcha-api-client-captcha-solver)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Configuration](#configuration)
|
|
18
|
+
- [Client instance options](#client-instance-options)
|
|
19
|
+
- [Solve captcha](#solve-captcha)
|
|
20
|
+
- [Captcha options](#captcha-options)
|
|
21
|
+
- [Normal Captcha](#normal-captcha)
|
|
22
|
+
- [Text Captcha](#text-captcha)
|
|
23
|
+
- [reCAPTCHA v2](#recaptcha-v2)
|
|
24
|
+
- [reCAPTCHA v3](#recaptcha-v3)
|
|
25
|
+
- [reCAPTCHA Enterprise](#recaptcha-enterprise)
|
|
26
|
+
- [FunCaptcha](#funcaptcha)
|
|
27
|
+
- [GeeTest](#geetest)
|
|
28
|
+
- [GeeTest V4](#geetest-v4)
|
|
29
|
+
- [KeyCaptcha](#keycaptcha)
|
|
30
|
+
- [Capy](#capy)
|
|
31
|
+
- [Grid](#grid)
|
|
32
|
+
- [Canvas](#canvas)
|
|
33
|
+
- [ClickCaptcha](#clickcaptcha)
|
|
34
|
+
- [Rotate](#rotate)
|
|
35
|
+
- [Amazon WAF](#amazon-waf)
|
|
36
|
+
- [Cloudflare Turnstile](#cloudflare-turnstile)
|
|
37
|
+
- [Lemin Cropped Captcha](#lemin-cropped-captcha)
|
|
38
|
+
- [Audio Captcha](#audio-captcha)
|
|
39
|
+
- [Yandex](#yandex)
|
|
40
|
+
- [CyberSiARA](#cybersiara)
|
|
41
|
+
- [DataDome](#datadome)
|
|
42
|
+
- [MTCaptcha](#mtcaptcha)
|
|
43
|
+
- [Friendly captcha](#friendly-captcha)
|
|
44
|
+
- [Cutcaptcha](#cutcaptcha)
|
|
45
|
+
- [Tencent](#tencent)
|
|
46
|
+
- [atbCAPTCHA](#atbcaptcha)
|
|
47
|
+
- [Prosopo](#prosopo)
|
|
48
|
+
- [Captchafox](#captchafox)
|
|
49
|
+
- [Temu](#temu)
|
|
50
|
+
- [VK Image](#vk-image)
|
|
51
|
+
- [VK Captcha](#vk-captcha)
|
|
52
|
+
- [Altcha Captcha](#altcha-captcha)
|
|
53
|
+
- [Hunt Captcha](#hunt-captcha)
|
|
54
|
+
- [Tspd](#tspd)
|
|
55
|
+
- [Basilisk](#basilisk)
|
|
56
|
+
- [Alibaba](#alibaba)
|
|
57
|
+
- [Yidun](#yidun)
|
|
58
|
+
- [Drag & Drop Captcha](#drag--drop-captcha)
|
|
59
|
+
- [Other methods](#other-methods)
|
|
60
|
+
- [send / get_result](#send--get_result)
|
|
61
|
+
- [balance](#balance)
|
|
62
|
+
- [report](#report)
|
|
63
|
+
- [Proxies](#proxies)
|
|
64
|
+
- [Error handling](#error-handling)
|
|
65
|
+
- [Examples](#examples)
|
|
66
|
+
- [Get in touch](#get-in-touch)
|
|
67
|
+
- [Join the team 👪](#join-the-team-)
|
|
68
|
+
- [License](#license)
|
|
69
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
42
70
|
|
|
43
71
|
## Installation
|
|
44
72
|
Add this line to your application's Gemfile:
|
|
@@ -77,12 +105,14 @@ client.api_key = "YOUR_API_KEY"
|
|
|
77
105
|
|
|
78
106
|
|Option |Default value|Description |
|
|
79
107
|
|----------------|-------------|------------------------------------------------------------------------|
|
|
80
|
-
|soft_id
|
|
108
|
+
|soft_id |4584 |your software ID obtained after publishing in [2captcha software catalog]|
|
|
81
109
|
|callback |- |URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account|
|
|
82
110
|
|default_timeout |120 |Timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint|
|
|
83
111
|
|polling_interval|10 |Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended|
|
|
84
112
|
|
|
85
|
-
>
|
|
113
|
+
> [!IMPORTANT]
|
|
114
|
+
> Once `callback` is defined for `Client` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
|
|
115
|
+
|
|
86
116
|
To get the answer manually use [get_result method](#send--get_result)
|
|
87
117
|
|
|
88
118
|
## Solve captcha
|
|
@@ -92,7 +122,7 @@ When you submit any image-based captcha use can provide additional options to he
|
|
|
92
122
|
| Option | Default Value | Description |
|
|
93
123
|
| ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
|
|
94
124
|
| numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][normal_post] |
|
|
95
|
-
| min_len | 0 | minimal answer
|
|
125
|
+
| min_len | 0 | minimal answer length |
|
|
96
126
|
| max_len | 0 | maximum answer length |
|
|
97
127
|
| phrase | 0 | defines if the answer contains multiple words or not |
|
|
98
128
|
| case_sensitive| 0 | defines if the answer is case sensitive |
|
|
@@ -105,6 +135,9 @@ Below you can find basic examples for every captcha type, check out the code bel
|
|
|
105
135
|
|
|
106
136
|
|
|
107
137
|
### Normal Captcha
|
|
138
|
+
|
|
139
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
|
|
140
|
+
|
|
108
141
|
To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.
|
|
109
142
|
```ruby
|
|
110
143
|
result = client.normal({ image: 'path/to/captcha.jpg'})
|
|
@@ -115,6 +148,9 @@ result = client.normal({
|
|
|
115
148
|
```
|
|
116
149
|
|
|
117
150
|
### Text Captcha
|
|
151
|
+
|
|
152
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
|
|
153
|
+
|
|
118
154
|
This method can be used to bypass a captcha that requires to answer a question provided in clear text.
|
|
119
155
|
```ruby
|
|
120
156
|
result = client.text({
|
|
@@ -124,6 +160,9 @@ result = client.text({
|
|
|
124
160
|
```
|
|
125
161
|
|
|
126
162
|
### reCAPTCHA v2
|
|
163
|
+
|
|
164
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
|
|
165
|
+
|
|
127
166
|
Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
|
|
128
167
|
```ruby
|
|
129
168
|
result = client.recaptcha_v2({
|
|
@@ -134,6 +173,9 @@ result = client.recaptcha_v2({
|
|
|
134
173
|
```
|
|
135
174
|
|
|
136
175
|
### reCAPTCHA v3
|
|
176
|
+
|
|
177
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
|
|
178
|
+
|
|
137
179
|
This method provides reCAPTCHA V3 solver and returns a token.
|
|
138
180
|
```ruby
|
|
139
181
|
result = client.recaptcha_v3({
|
|
@@ -146,6 +188,9 @@ result = client.recaptcha_v3({
|
|
|
146
188
|
```
|
|
147
189
|
|
|
148
190
|
### reCAPTCHA Enterprise
|
|
191
|
+
|
|
192
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#recaptcha-enterprise)</sup>
|
|
193
|
+
|
|
149
194
|
reCAPTCHA Enterprise can be used as reCAPTCHA V2 and reCAPTCHA V3. Below is a usage example for both versions.
|
|
150
195
|
|
|
151
196
|
```ruby
|
|
@@ -168,6 +213,9 @@ result = client.recaptcha_v3({
|
|
|
168
213
|
```
|
|
169
214
|
|
|
170
215
|
### FunCaptcha
|
|
216
|
+
|
|
217
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
|
|
218
|
+
|
|
171
219
|
FunCaptcha (Arkoselabs) solving method. Returns a token.
|
|
172
220
|
|
|
173
221
|
```ruby
|
|
@@ -178,6 +226,9 @@ result = client.funcaptcha({
|
|
|
178
226
|
```
|
|
179
227
|
|
|
180
228
|
### GeeTest
|
|
229
|
+
|
|
230
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
|
|
231
|
+
|
|
181
232
|
Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
|
|
182
233
|
```ruby
|
|
183
234
|
result = client.geetest({
|
|
@@ -188,16 +239,22 @@ result = client.geetest({
|
|
|
188
239
|
})
|
|
189
240
|
```
|
|
190
241
|
|
|
191
|
-
###
|
|
192
|
-
|
|
242
|
+
### GeeTest v4
|
|
243
|
+
|
|
244
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
|
|
245
|
+
|
|
246
|
+
Use this method to solve GeeTest v4. Returns the response in JSON.
|
|
193
247
|
```ruby
|
|
194
|
-
result = client.
|
|
195
|
-
|
|
248
|
+
result = client.geetest_v4({
|
|
249
|
+
captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
|
|
196
250
|
pageurl: 'https://www.site.com/page/'
|
|
197
251
|
})
|
|
198
252
|
```
|
|
199
253
|
|
|
200
254
|
### KeyCaptcha
|
|
255
|
+
|
|
256
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
|
|
257
|
+
|
|
201
258
|
Token-based method to solve KeyCaptcha.
|
|
202
259
|
```ruby
|
|
203
260
|
result = client.keycaptcha({
|
|
@@ -210,6 +267,9 @@ result = client.keycaptcha({
|
|
|
210
267
|
```
|
|
211
268
|
|
|
212
269
|
### Capy
|
|
270
|
+
|
|
271
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
|
|
272
|
+
|
|
213
273
|
Token-based method to bypass Capy puzzle captcha.
|
|
214
274
|
```ruby
|
|
215
275
|
result = client.capy({
|
|
@@ -220,20 +280,26 @@ result = client.capy({
|
|
|
220
280
|
```
|
|
221
281
|
|
|
222
282
|
### Grid
|
|
283
|
+
|
|
284
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
|
|
285
|
+
|
|
223
286
|
Grid method is originally called Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on image and need to click specific grid boxes. Returns numbers of boxes.
|
|
224
287
|
```ruby
|
|
225
288
|
result = client.grid({
|
|
226
289
|
image: 'path/to/captcha.jpg',
|
|
227
|
-
|
|
228
|
-
|
|
290
|
+
recaptcharows: 3,
|
|
291
|
+
recaptchacols: 3,
|
|
229
292
|
previous_id: 0,
|
|
230
293
|
lang: 'en',
|
|
231
|
-
|
|
232
|
-
|
|
294
|
+
imginstructions: 'path/to/hint.jpg',
|
|
295
|
+
textinstructions: 'Select all images with an Orange'
|
|
233
296
|
})
|
|
234
297
|
```
|
|
235
298
|
|
|
236
299
|
### Canvas
|
|
300
|
+
|
|
301
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
|
|
302
|
+
|
|
237
303
|
Canvas method can be used when you need to draw a line around an object on image. Returns a set of points' coordinates to draw a polygon.
|
|
238
304
|
```ruby
|
|
239
305
|
result = client.canvas({
|
|
@@ -246,6 +312,9 @@ result = client.canvas({
|
|
|
246
312
|
```
|
|
247
313
|
|
|
248
314
|
### ClickCaptcha
|
|
315
|
+
|
|
316
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
|
|
317
|
+
|
|
249
318
|
ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.
|
|
250
319
|
```ruby
|
|
251
320
|
result = client.coordinates({
|
|
@@ -257,6 +326,9 @@ result = client.coordinates({
|
|
|
257
326
|
```
|
|
258
327
|
|
|
259
328
|
### Rotate
|
|
329
|
+
|
|
330
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
|
|
331
|
+
|
|
260
332
|
This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
|
|
261
333
|
```ruby
|
|
262
334
|
result = client.rotate({
|
|
@@ -269,7 +341,10 @@ result = client.rotate({
|
|
|
269
341
|
```
|
|
270
342
|
|
|
271
343
|
### Lemin Cropped Captcha
|
|
272
|
-
|
|
344
|
+
|
|
345
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
|
|
346
|
+
|
|
347
|
+
Use this method to solve Lemin challenge. Returns JSON with answer containing the following values: answer, challenge_id.
|
|
273
348
|
```ruby
|
|
274
349
|
result = client.lemin({
|
|
275
350
|
captcha_id: 'CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
|
|
@@ -280,6 +355,9 @@ result = client.lemin({
|
|
|
280
355
|
```
|
|
281
356
|
|
|
282
357
|
### Cloudflare Turnstile
|
|
358
|
+
|
|
359
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
|
|
360
|
+
|
|
283
361
|
Use this method to solve Cloudflare Turnstile. Returns JSON with the token and User-Agent.
|
|
284
362
|
```ruby
|
|
285
363
|
result = client.turnstile({
|
|
@@ -294,6 +372,9 @@ result = client.turnstile({
|
|
|
294
372
|
```
|
|
295
373
|
|
|
296
374
|
### Amazon WAF
|
|
375
|
+
|
|
376
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
|
|
377
|
+
|
|
297
378
|
Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
|
|
298
379
|
```ruby
|
|
299
380
|
result = client.amazon_waf({
|
|
@@ -306,20 +387,15 @@ result = client.amazon_waf({
|
|
|
306
387
|
})
|
|
307
388
|
```
|
|
308
389
|
|
|
309
|
-
###
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
result = client.geetest_v4({
|
|
313
|
-
captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
|
|
314
|
-
pageurl: 'https://www.site.com/page/'
|
|
315
|
-
})
|
|
316
|
-
```
|
|
390
|
+
### Audio Captcha
|
|
391
|
+
|
|
392
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#audio)</sup>
|
|
317
393
|
|
|
318
|
-
|
|
319
|
-
|
|
394
|
+
Use the following method to bypass an audio captcha (mp3 formats only).
|
|
395
|
+
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
|
|
320
396
|
```ruby
|
|
321
397
|
result = client.audio({
|
|
322
|
-
audio: 'path/to/audio.
|
|
398
|
+
audio: 'path/to/audio.mp3',
|
|
323
399
|
lang: "en"
|
|
324
400
|
})
|
|
325
401
|
```
|
|
@@ -334,6 +410,9 @@ result = client.yandex({
|
|
|
334
410
|
```
|
|
335
411
|
|
|
336
412
|
### CyberSiARA
|
|
413
|
+
|
|
414
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
415
|
+
|
|
337
416
|
Use this method to solve CyberSiARA and obtain a token to bypass the protection.
|
|
338
417
|
```ruby
|
|
339
418
|
result = client.cyber_siara({
|
|
@@ -343,8 +422,15 @@ result = client.cyber_siara({
|
|
|
343
422
|
```
|
|
344
423
|
|
|
345
424
|
### DataDome
|
|
425
|
+
|
|
426
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#datadome)</sup>
|
|
427
|
+
|
|
346
428
|
Use this method to solve DataDome and obtain a token to bypass the protection.
|
|
347
|
-
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
> [!IMPORTANT]
|
|
432
|
+
> To solve the DataDome captcha, you must use a proxy. It is recommended to use [residential proxies].
|
|
433
|
+
|
|
348
434
|
```ruby
|
|
349
435
|
result = client.data_dome({
|
|
350
436
|
pageurl: "https://test.com",
|
|
@@ -355,6 +441,9 @@ result = client.data_dome({
|
|
|
355
441
|
```
|
|
356
442
|
|
|
357
443
|
### MTCaptcha
|
|
444
|
+
|
|
445
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
|
|
446
|
+
|
|
358
447
|
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
|
|
359
448
|
```ruby
|
|
360
449
|
result = client.mt_captcha({
|
|
@@ -364,7 +453,14 @@ result = client.mt_captcha({
|
|
|
364
453
|
```
|
|
365
454
|
|
|
366
455
|
### Friendly captcha
|
|
456
|
+
|
|
457
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
|
|
458
|
+
|
|
367
459
|
Use this method to solve Friendly captcha and obtain a token to bypass the protection.
|
|
460
|
+
|
|
461
|
+
> [!IMPORTANT]
|
|
462
|
+
> To successfully use the received token, the captcha widget must not be loaded on the page. To do this, you need to abort request to `/friendlycaptcha/...module.min.js` on the page. When the captcha widget is already loaded on the page, there is a high probability that the received token will not work.
|
|
463
|
+
|
|
368
464
|
```ruby
|
|
369
465
|
result = client.friendly({
|
|
370
466
|
pageurl: "https://example.com",
|
|
@@ -373,6 +469,9 @@ result = client.friendly({
|
|
|
373
469
|
```
|
|
374
470
|
|
|
375
471
|
### Cutcaptcha
|
|
472
|
+
|
|
473
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
|
|
474
|
+
|
|
376
475
|
Use this method to solve Cutcaptcha and obtain a token to bypass the protection.
|
|
377
476
|
```ruby
|
|
378
477
|
result = client.cutcaptcha({
|
|
@@ -382,6 +481,213 @@ result = client.cutcaptcha({
|
|
|
382
481
|
})
|
|
383
482
|
```
|
|
384
483
|
|
|
484
|
+
### Tencent
|
|
485
|
+
|
|
486
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
|
|
487
|
+
|
|
488
|
+
Token-based method for automated solving of Tencent captcha.
|
|
489
|
+
```ruby
|
|
490
|
+
result = client.tencent({
|
|
491
|
+
app_id: "197326679",
|
|
492
|
+
pageurl: "https://mysite.com/page/with/tencent"
|
|
493
|
+
})
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### atbCAPTCHA
|
|
497
|
+
|
|
498
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
|
|
499
|
+
|
|
500
|
+
Token-based method for automated solving of atbCAPTCHA.
|
|
501
|
+
```ruby
|
|
502
|
+
result = client.atb_captcha({
|
|
503
|
+
app_id: "197326679",
|
|
504
|
+
api_server: "api.atb_captcha.com",
|
|
505
|
+
pageurl: "https://mysite.com/page/with/atb_captcha"
|
|
506
|
+
})
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Prosopo
|
|
510
|
+
|
|
511
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
|
|
512
|
+
|
|
513
|
+
Token-based method for automated solving of Prosopo.
|
|
514
|
+
|
|
515
|
+
```ruby
|
|
516
|
+
result = client.prosopo({
|
|
517
|
+
pageurl: "https://www.twickets.live/",
|
|
518
|
+
sitekey: "5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"
|
|
519
|
+
})
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Captchafox
|
|
523
|
+
|
|
524
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
|
|
525
|
+
|
|
526
|
+
Token-based method for automated solving of Captchafox.
|
|
527
|
+
|
|
528
|
+
```ruby
|
|
529
|
+
result = client.captchafox({
|
|
530
|
+
sitekey: "sitekey",
|
|
531
|
+
pageurl: "https://pageurl/",
|
|
532
|
+
api_server: "https://mam.example.com",
|
|
533
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0 Safari/537.36",
|
|
534
|
+
proxytype: "socks5",
|
|
535
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
536
|
+
})
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Temu
|
|
540
|
+
|
|
541
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#temucaptcha)</sup>
|
|
542
|
+
|
|
543
|
+
Token-based method for automated solving of Temu.
|
|
544
|
+
|
|
545
|
+
```ruby
|
|
546
|
+
result = client.temu({
|
|
547
|
+
body: bodyStr,
|
|
548
|
+
part1: part1Str,
|
|
549
|
+
part2: part2Str,
|
|
550
|
+
part3: part3Str,
|
|
551
|
+
})
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
### VK Image
|
|
556
|
+
|
|
557
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>
|
|
558
|
+
|
|
559
|
+
We use the body (image in base64 format) or file (image as file) and steps parameters.
|
|
560
|
+
You can get both values from the response to the request https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} when loading the captcha widget on the page.
|
|
561
|
+
|
|
562
|
+
```ruby
|
|
563
|
+
result = client.vkimage({
|
|
564
|
+
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
|
|
565
|
+
steps: '[5,19,14,14,6,4,8...]'
|
|
566
|
+
})
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### VK Captcha
|
|
570
|
+
|
|
571
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>
|
|
572
|
+
|
|
573
|
+
Token-based method requires redirect_uri parameter, as well as proxy and userAgent. The value of the redirect_uri parameter can be found in the response to requests to the VK API that return captchas.
|
|
574
|
+
|
|
575
|
+
```ruby
|
|
576
|
+
result = client.vkcaptcha({
|
|
577
|
+
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
|
|
578
|
+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
|
|
579
|
+
})
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Altcha Captcha
|
|
583
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#altchacaptcha)</sup>
|
|
584
|
+
|
|
585
|
+
Use this method to solve Altcha Captcha. Returns a token.
|
|
586
|
+
|
|
587
|
+
```ruby
|
|
588
|
+
result = client.altcha({
|
|
589
|
+
pageurl: 'https://mysite.com/page/with/altcha',
|
|
590
|
+
challenge: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...","signature":"7b3e2a9d5c8f1046e2d91c3a..."}'
|
|
591
|
+
# or:
|
|
592
|
+
# challenge_url: 'https://example.com/altcha-challenge'
|
|
593
|
+
})
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Hunt Captcha
|
|
597
|
+
|
|
598
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#hunt)</sup>
|
|
599
|
+
|
|
600
|
+
Token-based method for automated solving of Hunt captcha. Uses a two-step workflow: the first request without `data` returns an X-HD fingerprint; after sending it to the site and receiving `meta.token`, a second request with `data` returns the final token.
|
|
601
|
+
|
|
602
|
+
> [!IMPORTANT]
|
|
603
|
+
> To solve the Hunt captcha, you must use a proxy. It is recommended to use [residential proxies].
|
|
604
|
+
|
|
605
|
+
```ruby
|
|
606
|
+
result = client.hunt({
|
|
607
|
+
pageurl: "https://example.com/page-with-hunt",
|
|
608
|
+
api_get_lib: "https://example.com/hd-api/external/apps/app-id/api.js",
|
|
609
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
610
|
+
proxytype: "http",
|
|
611
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
612
|
+
})
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### Tspd
|
|
616
|
+
|
|
617
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#tspd)</sup>
|
|
618
|
+
|
|
619
|
+
Use this method to solve TSPD captcha. Returns cookies. A proxy is required — there is no proxyless variant.
|
|
620
|
+
|
|
621
|
+
> [!IMPORTANT]
|
|
622
|
+
> To solve the TSPD captcha, you must use a proxy. The same outbound IP address must be maintained across all stages: getting cookies, solving the task, and using the result.
|
|
623
|
+
|
|
624
|
+
```ruby
|
|
625
|
+
result = client.tspd({
|
|
626
|
+
pageurl: "https://example.com/page-with-tspd",
|
|
627
|
+
tspd_cookie: "TS...",
|
|
628
|
+
html_page_base64: "PGh0bWw+...",
|
|
629
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
630
|
+
proxytype: "http",
|
|
631
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
632
|
+
})
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### Basilisk
|
|
636
|
+
|
|
637
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#basilisk)</sup>
|
|
638
|
+
|
|
639
|
+
Token-based method for automated solving of Basilisk captcha.
|
|
640
|
+
|
|
641
|
+
```ruby
|
|
642
|
+
result = client.basilisk({
|
|
643
|
+
pageurl: "https://example.com/page-with-basilisk",
|
|
644
|
+
sitekey: "SITE_KEY"
|
|
645
|
+
})
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Alibaba
|
|
649
|
+
|
|
650
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#alibaba)</sup>
|
|
651
|
+
|
|
652
|
+
Token-based method for automated solving of Alibaba captcha.
|
|
653
|
+
|
|
654
|
+
```ruby
|
|
655
|
+
result = client.alibaba({
|
|
656
|
+
pageurl: "https://example.com/page-with-alibaba",
|
|
657
|
+
scene_id: "SCENE_ID",
|
|
658
|
+
prefix: "PREFIX"
|
|
659
|
+
})
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### Yidun
|
|
663
|
+
|
|
664
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#yidun)</sup>
|
|
665
|
+
|
|
666
|
+
Token-based method for automated solving of Yidun captcha.
|
|
667
|
+
|
|
668
|
+
```ruby
|
|
669
|
+
result = client.yidun({
|
|
670
|
+
pageurl: "https://example.com/page-with-yidun",
|
|
671
|
+
sitekey: "SITE_KEY"
|
|
672
|
+
})
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### Drag & Drop Captcha
|
|
676
|
+
|
|
677
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#drag-and-drop-captcha)</sup>
|
|
678
|
+
|
|
679
|
+
Use this method to solve captchas where one or more images need to be dragged onto specific positions of a background image. `body` is the background image and `images` is an array of the images to drag onto it, both Base64-encoded — read the files and encode them yourself, as shown below. The order of `images` matters: the result uses the same order.
|
|
680
|
+
|
|
681
|
+
The result is a string with coordinates for each image from `images`, separated by `|`. An image that doesn't need to be moved comes back as the literal string `null`.
|
|
682
|
+
|
|
683
|
+
```ruby
|
|
684
|
+
result = client.drag_drop({
|
|
685
|
+
body: bodyStr,
|
|
686
|
+
images: [image1Str, image2Str],
|
|
687
|
+
textinstructions: "Drag the images to proper position"
|
|
688
|
+
})
|
|
689
|
+
```
|
|
690
|
+
|
|
385
691
|
## Other methods
|
|
386
692
|
|
|
387
693
|
### send / get_result
|
|
@@ -408,6 +714,9 @@ result = client.get_result(captcha_id)
|
|
|
408
714
|
```
|
|
409
715
|
|
|
410
716
|
### balance
|
|
717
|
+
|
|
718
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#additional-methods)</sup>
|
|
719
|
+
|
|
411
720
|
Use this method to get your account's balance
|
|
412
721
|
|
|
413
722
|
```ruby
|
|
@@ -415,6 +724,9 @@ balance = client.get_balance
|
|
|
415
724
|
```
|
|
416
725
|
|
|
417
726
|
### report
|
|
727
|
+
|
|
728
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#complain)</sup>
|
|
729
|
+
|
|
418
730
|
Use this method to report good or bad captcha answer.
|
|
419
731
|
```ruby
|
|
420
732
|
client.report(captcha_id, True) # captcha solved correctly
|
|
@@ -422,7 +734,7 @@ client.report(captcha_id, False) # captcha solved incorrectly
|
|
|
422
734
|
```
|
|
423
735
|
## Proxies
|
|
424
736
|
|
|
425
|
-
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4,
|
|
737
|
+
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, Cutcaptcha, Friendly captcha, MTCaptcha, DataDome, CyberSiARA and etc. The proxy will be forwarded to the API to solve the captcha.
|
|
426
738
|
|
|
427
739
|
We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
|
|
428
740
|
|
|
@@ -457,11 +769,36 @@ In case of an error, the captcha solver throws an exception. It's important to p
|
|
|
457
769
|
end
|
|
458
770
|
```
|
|
459
771
|
|
|
772
|
+
## Examples
|
|
773
|
+
|
|
774
|
+
Examples of solving all supported captcha types are located in the [examples] directory.
|
|
775
|
+
|
|
776
|
+
## Get in touch
|
|
777
|
+
|
|
778
|
+
<a href="mailto:support@2captcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
|
|
779
|
+
<a href="https://2captcha.com/support/tickets/new"><img src="https://github.com/user-attachments/assets/be044db5-2e67-46c6-8c81-04b78bd99650" width="81" height="30"></a>
|
|
780
|
+
|
|
781
|
+
## Join the team 👪
|
|
782
|
+
|
|
783
|
+
There are many ways to contribute, of which development is only one! Find your next job. Open positions: AI experts, scrapers, developers, technical support, and much more! 😍
|
|
784
|
+
|
|
785
|
+
<a href="mailto:job@2captcha.com"><img src="https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033" width="80" height="30"></a>
|
|
786
|
+
|
|
787
|
+
## License
|
|
788
|
+
|
|
789
|
+
The code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
|
|
790
|
+
|
|
791
|
+
### Graphics and Trademarks
|
|
792
|
+
|
|
793
|
+
The graphics and trademarks included in this repository are not covered by the MIT License. Please contact <a href="mailto:support@2captcha.com">support</a> for permissions regarding the use of these materials.
|
|
794
|
+
|
|
460
795
|
<!-- Shared links -->
|
|
461
796
|
[2Captcha]: https://2captcha.com/
|
|
462
|
-
[2captcha
|
|
797
|
+
[2captcha software catalog]: https://2captcha.com/software
|
|
463
798
|
[pingback settings]: https://2captcha.com/setting/pingback
|
|
464
799
|
[normal_post]: https://2captcha.com/2captcha-api#normal_post
|
|
465
800
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
466
801
|
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
467
|
-
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
802
|
+
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
803
|
+
[examples]: ./examples/
|
|
804
|
+
[residential proxies]: https://2captcha.com/proxy/residential-proxies
|