ruby-2captcha 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94adc4930618e4ff87a67f2863b7bcafdde25e41907547b8a5ed95d95bd20708
4
- data.tar.gz: c98061247be1c224ebd09271a25bcca3e00dd010d6c2b698e2a5a931d1fbfb34
3
+ metadata.gz: f3cf34c705f05cac002afa61dbfe4ded7b7e1f07a579fa0d2e98c52ec1972ebc
4
+ data.tar.gz: 7aeb0c18eb4f7136278ef3ab528312eced958cd4ef1ebd2ee33a44296e4ed416
5
5
  SHA512:
6
- metadata.gz: c02f909803243426c91c9b908595717dba50e837d517f8260d0ffca48999cb02c098211bc3144c04c39314cf5a5617d085143b90d91cffa46b888b12d1624b29
7
- data.tar.gz: 44bfc875ace31d895ff44b4d826250ab62af899ddf32a87b34b0b640f7dd83a9f0a40efac8e9babe1610121be9181921faf850322f22d1da6e611c7d5a5d09ba
6
+ metadata.gz: c092dcb03fc11e1de8aff2a41b7b1b8908ee19e66dd643d8aaf4dd12cdab9d920e68a60b6f63c55e6ea9271b93f8b9d54aa3ea1d0991e8f11ae9cbad48d1b813
7
+ data.tar.gz: 7c42d06519aa623dcf5652d036bc85864f1df0725d913c3c7be2d3be2f7b8502367ed802ccba7f3908a3f2bf711840a50e36a54c53b4a35df0b9699cb008fc4b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-2captcha (1.0.2)
4
+ ruby-2captcha (1.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -20,7 +20,7 @@ GEM
20
20
  rainbow (3.1.1)
21
21
  rake (13.0.6)
22
22
  regexp_parser (2.8.0)
23
- rexml (3.2.5)
23
+ rexml (3.3.9)
24
24
  rspec (3.12.0)
25
25
  rspec-core (~> 3.12.0)
26
26
  rspec-expectations (~> 3.12.0)
@@ -34,7 +34,7 @@ GEM
34
34
  diff-lcs (>= 1.2.0, < 2.0)
35
35
  rspec-support (~> 3.12.0)
36
36
  rspec-support (3.12.0)
37
- rubocop (1.51.0)
37
+ rubocop (1.50.2)
38
38
  json (~> 2.3)
39
39
  parallel (~> 1.10)
40
40
  parser (>= 3.2.0.0)
@@ -51,7 +51,7 @@ GEM
51
51
  time (0.2.2)
52
52
  date
53
53
  unicode-display_width (2.4.2)
54
- uri (0.12.1)
54
+ uri (0.13.0)
55
55
 
56
56
  PLATFORMS
57
57
  ruby
@@ -64,4 +64,4 @@ DEPENDENCIES
64
64
  ruby-2captcha!
65
65
 
66
66
  BUNDLED WITH
67
- 2.4.12
67
+ 2.4.22
data/README.md CHANGED
@@ -1,44 +1,60 @@
1
- # Ruby 2Captcha API Client
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
- This is the easiest way to quickly integrate [2Captcha] into your code and automate solving of any type of captcha.
10
+ # Ruby 2Captcha API Client (captcha solver)
4
11
 
5
- A Ruby client for the 2Captcha API.
6
-
7
- - [Installation](#installation)
8
- - [Configuration](#configuration)
9
- - [Client instance options](#client-instance-options)
10
- - [Solve captcha](#solve-captcha)
11
- - [Normal Captcha](#normal-captcha)
12
- - [Text](#text-captcha)
13
- - [reCAPTCHA v2](#recaptcha-v2)
14
- - [reCAPTCHA v3](#recaptcha-v3)
15
- - [reCAPTCHA Enterprise](#recaptcha-enterprise)
16
- - [FunCaptcha](#funcaptcha)
17
- - [GeeTest](#geetest)
18
- - [hCaptcha](#hcaptcha)
19
- - [KeyCaptcha](#keycaptcha)
20
- - [Capy](#capy)
21
- - [Grid](#grid)
22
- - [Canvas](#canvas)
23
- - [ClickCaptcha](#clickcaptcha)
24
- - [Rotate](#rotate)
25
- - [AmazonWAF](#amazon-waf)
26
- - [CloudflareTurnstile](#cloudflare-turnstile)
27
- - [Lemin Cropped Captcha](#lemin-cropped-captcha)
28
- - [GeeTest V4](#geetest-v4)
29
- - [Audio](#audio)
30
- - [Yandex](#yandex)
31
- - [CyberSiARA](#cybersiara)
32
- - [DataDome](#datadome)
33
- - [MTCaptcha](#mtcaptcha)
34
- - [Friendly captcha](#friendly-captcha)
35
- - [Cutcaptcha](#cutcaptcha)
36
- - [Other methods](#other-methods)
37
- - [send / get_result](#send--get_result)
38
- - [balance](#balance)
39
- - [report](#report)
40
- - [Proxies](#proxies)
41
- - [Error handling](#error-handling)
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
+ - [Other methods](#other-methods)
48
+ - [send / get_result](#send--get_result)
49
+ - [balance](#balance)
50
+ - [report](#report)
51
+ - [Proxies](#proxies)
52
+ - [Error handling](#error-handling)
53
+ - [Examples](#examples)
54
+ - [Get in touch](#get-in-touch)
55
+ - [Join the team 👪](#join-the-team-)
56
+ - [License](#license)
57
+ - [Graphics and Trademarks](#graphics-and-trademarks)
42
58
 
43
59
  ## Installation
44
60
  Add this line to your application's Gemfile:
@@ -77,12 +93,14 @@ client.api_key = "YOUR_API_KEY"
77
93
 
78
94
  |Option |Default value|Description |
79
95
  |----------------|-------------|------------------------------------------------------------------------|
80
- |soft_id |- |your software ID obtained after publishing in [2captcha sofware catalog]|
96
+ |soft_id |4584 |your software ID obtained after publishing in [2captcha sofware catalog]|
81
97
  |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
98
  |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
99
  |polling_interval|10 |Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended|
84
100
 
85
- > **IMPORTANT:** 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.
101
+ > [!IMPORTANT]
102
+ > 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.
103
+
86
104
  To get the answer manually use [get_result method](#send--get_result)
87
105
 
88
106
  ## Solve captcha
@@ -105,6 +123,9 @@ Below you can find basic examples for every captcha type, check out the code bel
105
123
 
106
124
 
107
125
  ### Normal Captcha
126
+
127
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
128
+
108
129
  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
130
  ```ruby
110
131
  result = client.normal({ image: 'path/to/captcha.jpg'})
@@ -115,6 +136,9 @@ result = client.normal({
115
136
  ```
116
137
 
117
138
  ### Text Captcha
139
+
140
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
141
+
118
142
  This method can be used to bypass a captcha that requires to answer a question provided in clear text.
119
143
  ```ruby
120
144
  result = client.text({
@@ -124,6 +148,9 @@ result = client.text({
124
148
  ```
125
149
 
126
150
  ### reCAPTCHA v2
151
+
152
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
153
+
127
154
  Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
128
155
  ```ruby
129
156
  result = client.recaptcha_v2({
@@ -134,6 +161,9 @@ result = client.recaptcha_v2({
134
161
  ```
135
162
 
136
163
  ### reCAPTCHA v3
164
+
165
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
166
+
137
167
  This method provides reCAPTCHA V3 solver and returns a token.
138
168
  ```ruby
139
169
  result = client.recaptcha_v3({
@@ -146,6 +176,9 @@ result = client.recaptcha_v3({
146
176
  ```
147
177
 
148
178
  ### reCAPTCHA Enterprise
179
+
180
+ <sup>[API method description.](https://2captcha.com/2captcha-api#recaptcha-enterprise)</sup>
181
+
149
182
  reCAPTCHA Enterprise can be used as reCAPTCHA V2 and reCAPTCHA V3. Below is a usage example for both versions.
150
183
 
151
184
  ```ruby
@@ -168,6 +201,9 @@ result = client.recaptcha_v3({
168
201
  ```
169
202
 
170
203
  ### FunCaptcha
204
+
205
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
206
+
171
207
  FunCaptcha (Arkoselabs) solving method. Returns a token.
172
208
 
173
209
  ```ruby
@@ -178,6 +214,9 @@ result = client.funcaptcha({
178
214
  ```
179
215
 
180
216
  ### GeeTest
217
+
218
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
219
+
181
220
  Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
182
221
  ```ruby
183
222
  result = client.geetest({
@@ -188,16 +227,22 @@ result = client.geetest({
188
227
  })
189
228
  ```
190
229
 
191
- ### hCaptcha
192
- Use this method to solve hCaptcha challenge. Returns a token to bypass captcha.
230
+ ### GeeTest v4
231
+
232
+ <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
233
+
234
+ Use this method to solve GeeTest v4. Returns the response in JSON.
193
235
  ```ruby
194
- result = client.hcaptcha({
195
- sitekey: '10000000-ffff-ffff-ffff-000000000001',
236
+ result = client.geetest_v4({
237
+ captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
196
238
  pageurl: 'https://www.site.com/page/'
197
239
  })
198
240
  ```
199
241
 
200
242
  ### KeyCaptcha
243
+
244
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
245
+
201
246
  Token-based method to solve KeyCaptcha.
202
247
  ```ruby
203
248
  result = client.keycaptcha({
@@ -210,6 +255,9 @@ result = client.keycaptcha({
210
255
  ```
211
256
 
212
257
  ### Capy
258
+
259
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
260
+
213
261
  Token-based method to bypass Capy puzzle captcha.
214
262
  ```ruby
215
263
  result = client.capy({
@@ -220,20 +268,26 @@ result = client.capy({
220
268
  ```
221
269
 
222
270
  ### Grid
271
+
272
+ <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
273
+
223
274
  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
275
  ```ruby
225
276
  result = client.grid({
226
277
  image: 'path/to/captcha.jpg',
227
- rows: 3,
228
- cols: 3,
278
+ recaptcharows: 3,
279
+ recaptchacols: 3,
229
280
  previous_id: 0,
230
281
  lang: 'en',
231
- hint_image: 'path/to/hint.jpg',
232
- hint_text: 'Select all images with an Orange'
282
+ imginstructions: 'path/to/hint.jpg',
283
+ textinstructions: 'Select all images with an Orange'
233
284
  })
234
285
  ```
235
286
 
236
287
  ### Canvas
288
+
289
+ <sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
290
+
237
291
  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
292
  ```ruby
239
293
  result = client.canvas({
@@ -246,6 +300,9 @@ result = client.canvas({
246
300
  ```
247
301
 
248
302
  ### ClickCaptcha
303
+
304
+ <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
305
+
249
306
  ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.
250
307
  ```ruby
251
308
  result = client.coordinates({
@@ -257,6 +314,9 @@ result = client.coordinates({
257
314
  ```
258
315
 
259
316
  ### Rotate
317
+
318
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
319
+
260
320
  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
321
  ```ruby
262
322
  result = client.rotate({
@@ -269,7 +329,10 @@ result = client.rotate({
269
329
  ```
270
330
 
271
331
  ### Lemin Cropped Captcha
272
- Use this method to solve hCaptcha challenge. Returns JSON with answer containing the following values: answer, challenge_id.
332
+
333
+ <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
334
+
335
+ Use this method to solve Lemin challenge. Returns JSON with answer containing the following values: answer, challenge_id.
273
336
  ```ruby
274
337
  result = client.lemin({
275
338
  captcha_id: 'CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
@@ -280,6 +343,9 @@ result = client.lemin({
280
343
  ```
281
344
 
282
345
  ### Cloudflare Turnstile
346
+
347
+ <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
348
+
283
349
  Use this method to solve Cloudflare Turnstile. Returns JSON with the token and User-Agent.
284
350
  ```ruby
285
351
  result = client.turnstile({
@@ -294,6 +360,9 @@ result = client.turnstile({
294
360
  ```
295
361
 
296
362
  ### Amazon WAF
363
+
364
+ <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
365
+
297
366
  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
367
  ```ruby
299
368
  result = client.amazon_waf({
@@ -306,20 +375,15 @@ result = client.amazon_waf({
306
375
  })
307
376
  ```
308
377
 
309
- ### GeeTest v4
310
- Use this method to solve GeeTest v4. Returns the response in JSON.
311
- ```ruby
312
- result = client.geetest_v4({
313
- captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
314
- pageurl: 'https://www.site.com/page/'
315
- })
316
- ```
378
+ ### Audio Captcha
317
379
 
318
- ### Audio
319
- This method can be used to solve a audio captcha
380
+ <sup>[API method description.](https://2captcha.com/2captcha-api#audio)</sup>
381
+
382
+ Use the following method to bypass an audio captcha (mp3 formats only).
383
+ You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
320
384
  ```ruby
321
385
  result = client.audio({
322
- audio: 'path/to/audio.jpg',
386
+ audio: 'path/to/audio.mp3',
323
387
  lang: "en"
324
388
  })
325
389
  ```
@@ -334,6 +398,9 @@ result = client.yandex({
334
398
  ```
335
399
 
336
400
  ### CyberSiARA
401
+
402
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
403
+
337
404
  Use this method to solve CyberSiARA and obtain a token to bypass the protection.
338
405
  ```ruby
339
406
  result = client.cyber_siara({
@@ -343,8 +410,15 @@ result = client.cyber_siara({
343
410
  ```
344
411
 
345
412
  ### DataDome
413
+
414
+ <sup>[API method description.](https://2captcha.com/2captcha-api#datadome)</sup>
415
+
346
416
  Use this method to solve DataDome and obtain a token to bypass the protection.
347
- To solve the DataDome captcha, you must use a proxy.
417
+
418
+
419
+ > [!IMPORTANT]
420
+ > To solve the DataDome captcha, you must use a proxy. It is recommended to use [residential proxies].
421
+
348
422
  ```ruby
349
423
  result = client.data_dome({
350
424
  pageurl: "https://test.com",
@@ -355,6 +429,9 @@ result = client.data_dome({
355
429
  ```
356
430
 
357
431
  ### MTCaptcha
432
+
433
+ <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
434
+
358
435
  Use this method to solve MTCaptcha and obtain a token to bypass the protection.
359
436
  ```ruby
360
437
  result = client.mt_captcha({
@@ -364,7 +441,14 @@ result = client.mt_captcha({
364
441
  ```
365
442
 
366
443
  ### Friendly captcha
444
+
445
+ <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
446
+
367
447
  Use this method to solve Friendly captcha and obtain a token to bypass the protection.
448
+
449
+ > [!IMPORTANT]
450
+ > 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.
451
+
368
452
  ```ruby
369
453
  result = client.friendly({
370
454
  pageurl: "https://example.com",
@@ -373,6 +457,9 @@ result = client.friendly({
373
457
  ```
374
458
 
375
459
  ### Cutcaptcha
460
+
461
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
462
+
376
463
  Use this method to solve Cutcaptcha and obtain a token to bypass the protection.
377
464
  ```ruby
378
465
  result = client.cutcaptcha({
@@ -382,6 +469,31 @@ result = client.cutcaptcha({
382
469
  })
383
470
  ```
384
471
 
472
+ ### Tencent
473
+
474
+ <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
475
+
476
+ Token-based method for automated solving of Tencent captcha.
477
+ ```ruby
478
+ result = client.tencent({
479
+ app_id: "197326679",
480
+ pageurl: "https://mysite.com/page/with/tencent"
481
+ })
482
+ ```
483
+
484
+ ### atbCAPTCHA
485
+
486
+ <sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
487
+
488
+ Token-based method for automated solving of atbCAPTCHA.
489
+ ```ruby
490
+ result = client.atb_captcha({
491
+ app_id: "197326679",
492
+ api_server: "api.atb_captcha.com",
493
+ pageurl: "https://mysite.com/page/with/atb_captcha"
494
+ })
495
+ ```
496
+
385
497
  ## Other methods
386
498
 
387
499
  ### send / get_result
@@ -408,6 +520,9 @@ result = client.get_result(captcha_id)
408
520
  ```
409
521
 
410
522
  ### balance
523
+
524
+ <sup>[API method description.](https://2captcha.com/2captcha-api#additional-methods)</sup>
525
+
411
526
  Use this method to get your account's balance
412
527
 
413
528
  ```ruby
@@ -415,6 +530,9 @@ balance = client.get_balance
415
530
  ```
416
531
 
417
532
  ### report
533
+
534
+ <sup>[API method description.](https://2captcha.com/2captcha-api#complain)</sup>
535
+
418
536
  Use this method to report good or bad captcha answer.
419
537
  ```ruby
420
538
  client.report(captcha_id, True) # captcha solved correctly
@@ -422,7 +540,7 @@ client.report(captcha_id, False) # captcha solved incorrectly
422
540
  ```
423
541
  ## Proxies
424
542
 
425
- You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha, 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.
543
+ 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
544
 
427
545
  We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
428
546
 
@@ -457,6 +575,29 @@ In case of an error, the captcha solver throws an exception. It's important to p
457
575
  end
458
576
  ```
459
577
 
578
+ ## Examples
579
+
580
+ Examples of solving all supported captcha types are located in the [examples] directory.
581
+
582
+ ## Get in touch
583
+
584
+ <a href="mailto:support@2captcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
585
+ <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>
586
+
587
+ ## Join the team 👪
588
+
589
+ 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! 😍
590
+
591
+ <a href="mailto:job@2captcha.com"><img src="https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033" width="80" height="30"></a>
592
+
593
+ ## License
594
+
595
+ The code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
596
+
597
+ ### Graphics and Trademarks
598
+
599
+ 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.
600
+
460
601
  <!-- Shared links -->
461
602
  [2Captcha]: https://2captcha.com/
462
603
  [2captcha sofware catalog]: https://2captcha.com/software
@@ -464,4 +605,6 @@ In case of an error, the captcha solver throws an exception. It's important to p
464
605
  [normal_post]: https://2captcha.com/2captcha-api#normal_post
465
606
  [list of supported languages]: https://2captcha.com/2captcha-api#language
466
607
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
467
- [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
608
+ [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
609
+ [examples]: ./examples/
610
+ [residential proxies]: https://2captcha.com/proxy/residential-proxies
data/README.ru.md CHANGED
@@ -1,42 +1,57 @@
1
- # Ruby 2Captcha API Client
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
- Это самый простой способ быстро интегрировать [2Captcha] в ваш код и автоматизировать решение любого типа капчи.
10
+ # Ruby 2Captcha API Client (captcha solver)
4
11
 
5
- Ruby-клиент для API 2Captcha.
6
-
7
- - [Установка](#установка)
8
- - [Настройка](#настройка)
9
- - [Опции экземпляра клиента](#опции-экземпляра-клиента)
10
- - [Решение капчи](#решение-капчи)
11
- - [Обычная капча](#обычная-капча)
12
- - [Текстовая капча](#текстовая-капча)
13
- - [reCAPTCHA v2](#recaptcha-v2)
14
- - [reCAPTCHA v3](#recaptcha-v3)
15
- - [FunCaptcha](#funcaptcha)
16
- - [GeeTest](#geetest)
17
- - [hCaptcha](#hcaptcha)
18
- - [KeyCaptcha](#keycaptcha)
19
- - [Capy](#capy)
20
- - [Grid](#grid)
21
- - [Canvas](#canvas)
22
- - [ClickCaptcha](#clickcaptcha)
23
- - [Rotate](#rotate)
24
- - [AmazonWAF](#amazon-waf)
25
- - [CloudflareTurnstile](#cloudflare-turnstile)
26
- - [Lemin Cropped Captcha](#lemin-cropped-captcha)
27
- - [GeeTest V4](#geetest-v4)
28
- - [Аудио](#audio)
29
- - [CyberSiARA](#cybersiara)
30
- - [DataDome](#datadome)
31
- - [MTCaptcha](#mtcaptcha)
32
- - [Friendly captcha](#friendly-captcha)
33
- - [Cutcaptcha](#cutcaptcha)
34
- - [Другие методы](#другие-методы)
35
- - [send / get_result](#send--get_result)
36
- - [Баланс](#баланс)
37
- - [Отчет](#отчет)
38
- - [Прокси](#прокси)
39
- - [Обработка ошибок](#обработка-ошибок)
12
+ Это самый простой способ быстро интегрировать [2Captcha] в ваш код и автоматизировать решение любого типа капчи.
13
+ Примеры API-запросов для различных типов капч доступны на странице [Ruby captcha solver](https://2captcha.com/lang/ruby).
14
+
15
+ - [Ruby 2Captcha API Client (captcha solver)](#ruby-2captcha-api-client-captcha-solver)
16
+ - [Установка](#установка)
17
+ - [Настройка](#настройка)
18
+ - [Опции экземпляра клиента](#опции-экземпляра-клиента)
19
+ - [Решение капчи](#решение-капчи)
20
+ - [Обычная капча](#обычная-капча)
21
+ - [Текстовая капча](#текстовая-капча)
22
+ - [reCAPTCHA v2](#recaptcha-v2)
23
+ - [reCAPTCHA v3](#recaptcha-v3)
24
+ - [FunCaptcha](#funcaptcha)
25
+ - [GeeTest](#geetest)
26
+ - [GeeTest V4](#geetest-v4)
27
+ - [KeyCaptcha](#keycaptcha)
28
+ - [Capy](#capy)
29
+ - [Grid](#grid)
30
+ - [Canvas](#canvas)
31
+ - [ClickCaptcha](#clickcaptcha)
32
+ - [Rotate](#rotate)
33
+ - [Amazon WAF](#amazon-waf)
34
+ - [Cloudflare Turnstile](#cloudflare-turnstile)
35
+ - [Lemin Cropped Captcha](#lemin-cropped-captcha)
36
+ - [Распознавание аудио](#распознавание-аудио)
37
+ - [CyberSiARA](#cybersiara)
38
+ - [DataDome](#datadome)
39
+ - [MTCaptcha](#mtcaptcha)
40
+ - [Friendly captcha](#friendly-captcha)
41
+ - [Cutcaptcha](#cutcaptcha)
42
+ - [Tencent](#tencent)
43
+ - [atbCAPTCHA](#atbcaptcha)
44
+ - [Другие методы](#другие-методы)
45
+ - [send / get_result](#send--get_result)
46
+ - [Баланс](#баланс)
47
+ - [Отчет](#отчет)
48
+ - [Прокси](#прокси)
49
+ - [Обработка ошибок](#обработка-ошибок)
50
+ - [Примеры](#примеры)
51
+ - [Свяжитесь с нами](#свяжитесь-с-нами)
52
+ - [Присоединяйтесь к команде 👪](#join-the-team)
53
+ - [Лицензия](#лицензия)
54
+ - [Графика и товарные знаки](#графика-и-товарные-знаки)
40
55
 
41
56
  ## Установка
42
57
  Автоматическая установка гема с помощью Bundler. Добавьте следующую строку в ваш Gemfile:
@@ -62,7 +77,7 @@ gem install ruby-2captcha
62
77
 
63
78
  Описание всех необходимых параметров для настройки установленного гема.
64
79
 
65
- Экземпляр класса Api2Captcha можно создать следующим образом:
80
+ Экземпляр класса `Api2Captcha` можно создать следующим образом:
66
81
 
67
82
  ```ruby
68
83
  require 'api_2captcha'
@@ -70,7 +85,7 @@ require 'api_2captcha'
70
85
  client = Api2Captcha.new("YOUR_API_KEY")
71
86
  ```
72
87
  ### Опции экземпляра клиента
73
- У вас также есть возможность настроить некоторые параметры экземпляра Api2Captcha:
88
+ У вас также есть возможность настроить некоторые параметры экземпляра `Api2Captcha`:
74
89
 
75
90
  ```ruby
76
91
  client.soft_id(123)
@@ -80,28 +95,34 @@ client.default_timeout(120)
80
95
  client.polling_interval(10)
81
96
  ```
82
97
 
83
- **ВАЖНО**: после определения обратного вызова для экземпляра , все методы возвращают только идентификатор капчи и НЕ запрашивают результат у API. Результат будет отправлен на URL обратного вызова. Чтобы получить ответ вручную, используйте метод get_result.
98
+ > [!IMPORTANT]
99
+ > После определения обратного вызова для экземпляра, все методы возвращают только идентификатор капчи и НЕ запрашивают результат у API. Результат будет отправлен на URL обратного вызова.
100
+
101
+ Чтобы получить ответ вручную, используйте метод [get_result](#send--get_result).
84
102
 
85
103
  ## Решение капчи
86
- При отправке любой капчи, основанной на изображении, вы можете предоставить дополнительные параметры, чтобы помочь работникам 2Captcha правильно ее решить.
104
+ При отправке любой капчи, основанной на изображении, вы можете предоставить дополнительные параметры, чтобы помочь работникам 2Captcha правильно её решить.
87
105
 
88
106
  ### Параметры капчи
89
107
 
90
- | Параметр | Значение по умолчанию | Описание |
91
- |-------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------|
92
- | numeric | 0 | Определяет, содержит ли капча числа или другие символы [подробнее см. в документации по API](https://2captcha.com/2captcha-api#solving_normal_captcha) |
93
- | min_len | 0 | Минимальная длина ответа length |
94
- | max_len | 0 | Максимальная длина ответа length |
95
- | phrase | 0 | Определяет, содержит ли ответ несколько слов или нет |
96
- | case_sensitive | 0 | Определяет, учитывается ли регистр в ответе |
97
- | calc | 0 | Определяет, требуется ли вычисление в решении капчи |
108
+ | Параметр | Значение по умолчанию | Описание |
109
+ |-------------------|---------------|--------------------------------------------------------------------------------------------------------------------|
110
+ | numeric | 0 | Определяет, содержит ли капча числа или другие символы [подробнее см. в документации по API](https://2captcha.com/2captcha-api#solving_normal_captcha) |
111
+ | min_len | 0 | Минимальная длина ответа length |
112
+ | max_len | 0 | Максимальная длина ответа length |
113
+ | phrase | 0 | Определяет, содержит ли ответ несколько слов или нет |
114
+ | case_sensitive | 0 | Определяет, учитывается ли регистр в ответе |
115
+ | calc | 0 | Определяет, требуется ли вычисление в решении капчи |
98
116
  | lang | - | Определяет язык капчи, см. [список поддерживаемых языков](https://2captcha.com/2captcha-api#language) |
99
- | hint_image | - | Изображение с подсказкой, показываемое работникам с капчей, переведенное из параметра API instructionsimg |
100
- | hint_text | - | Подсказка или текст задания, показываемые работникам с капчей |
117
+ | hint_image | - | Изображение с подсказкой, показываемое работникам с капчей, переведенное из параметра API instructionsimg |
118
+ | hint_text | - | Подсказка или текст задания, показываемые работникам с капчей |
101
119
 
102
120
  Ниже вы найдете основные примеры для каждого типа капчи. Ознакомьтесь с кодом ниже.
103
121
 
104
122
  ### Обычная капча
123
+
124
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
125
+
105
126
  Для обхода обычной капчи (искаженный текст на картинке) используйте следующий метод. Этот метод также может использоваться для распознавания любого текста на картинке.
106
127
 
107
128
  ```ruby
@@ -111,8 +132,11 @@ result = client.normal({
111
132
  image: 'https://site-with-captcha.com/path/to/captcha.jpg'
112
133
  })
113
134
  ```
135
+
114
136
  ### Текстовая капча
115
137
 
138
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
139
+
116
140
  Этот метод может использоваться для обхода капчи, которая требует ответить на вопрос, представленный в явном виде.
117
141
 
118
142
  ```ruby
@@ -123,6 +147,9 @@ result = client.text({
123
147
  ```
124
148
 
125
149
  ### reCAPTCHA v2
150
+
151
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
152
+
126
153
  Используйте этот метод для решения reCAPTCHA v2 и получения токена для обхода защиты.
127
154
 
128
155
  ```ruby
@@ -134,6 +161,9 @@ result = client.recaptcha_v2({
134
161
  ```
135
162
 
136
163
  ### reCAPTCHA v3
164
+
165
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
166
+
137
167
  Этот метод предоставляет решение для reCAPTCHA v3 и возвращает токен.
138
168
 
139
169
  ```ruby
@@ -147,6 +177,9 @@ result = client.recaptcha_v3({
147
177
  ```
148
178
 
149
179
  ### FunCaptcha
180
+
181
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
182
+
150
183
  Метод решения FunCaptcha (Arkoselabs). Он возвращает токен.
151
184
 
152
185
  ```ruby
@@ -157,6 +190,9 @@ result = client.funcaptcha({
157
190
  ```
158
191
 
159
192
  ### GeeTest
193
+
194
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
195
+
160
196
  Метод для решения головоломки GeeTest captcha. Он возвращает набор токенов в формате JSON.
161
197
 
162
198
  ```ruby
@@ -168,17 +204,24 @@ result = client.geetest({
168
204
  })
169
205
  ```
170
206
 
171
- ### hCaptcha
172
- Метод решения hCaptcha. Он возвращает токен для обхода капчи.
207
+ ### GeeTest v4
208
+
209
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
210
+
211
+ Используйте этот метод для решения GeeTest v4. Он возвращает ответ в формате JSON.
173
212
 
174
213
  ```ruby
175
- result = client.hcaptcha({
176
- sitekey: '10000000-ffff-ffff-ffff-000000000001',
214
+ result = client.geetest_v4({
215
+ captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
177
216
  pageurl: 'https://www.site.com/page/'
178
217
  })
179
218
  ```
180
219
 
220
+
181
221
  ### KeyCaptcha
222
+
223
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
224
+
182
225
  Метод на основе токенов для решения KeyCaptcha.
183
226
 
184
227
  ```ruby
@@ -192,6 +235,9 @@ result = client.keycaptcha({
192
235
  ```
193
236
 
194
237
  ### Capy
238
+
239
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_capy)</sup>
240
+
195
241
  Метод основан на использовании токенов для обхода паззла Capy.
196
242
 
197
243
  ```ruby
@@ -203,21 +249,27 @@ result = client.capy({
203
249
  ```
204
250
 
205
251
  ### Grid
252
+
253
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#grid)</sup>
254
+
206
255
  Метод сетки изначально называется методом Old ReCaptcha V2. Этот метод может быть использован для обхода любого типа капчи, где вы можете применить сетку к изображению и необходимо кликнуть по определенным ячейкам сетки. Он возвращает количество выбранных ячеек.
207
256
 
208
257
  ```ruby
209
258
  result = client.grid({
210
259
  image: 'path/to/captcha.jpg',
211
- rows: 3,
212
- cols: 3,
260
+ recaptcharows: 3,
261
+ recaptchacols: 3,
213
262
  previous_id: 0,
214
263
  lang: 'en',
215
- hint_image: 'path/to/hint.jpg',
216
- hint_text: 'Select all images with an Orange'
264
+ imginstructions: 'path/to/hint.jpg',
265
+ textinstructions: 'Select all images with an Orange'
217
266
  })
218
267
  ```
219
268
 
220
269
  ### Canvas
270
+
271
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#canvas)</sup>
272
+
221
273
  Метод Canvas может быть использован, когда вам необходимо нарисовать линию вокруг объекта на изображении. Он возвращает набор координат точек для рисования многоугольника.
222
274
 
223
275
  ```ruby
@@ -231,6 +283,9 @@ result = client.canvas({
231
283
  ```
232
284
 
233
285
  ### ClickCaptcha
286
+
287
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#coordinates)</sup>
288
+
234
289
  Метод ClickCaptcha возвращает координаты точек на изображении капчи. Может быть использован, если вам необходимо кликнуть по определенным точкам на изображении.
235
290
 
236
291
  ```ruby
@@ -243,6 +298,9 @@ result = client.coordinates({
243
298
  ```
244
299
 
245
300
  ### Rotate
301
+
302
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
303
+
246
304
  Этот метод может быть использован для решения капчи, которая просит повернуть объект. В основном используется для обхода FunCaptcha. Он возвращает угол поворота.
247
305
 
248
306
  ```ruby
@@ -257,7 +315,10 @@ result = client.rotate({
257
315
 
258
316
 
259
317
  ### Lemin Cropped Captcha
260
- Используйте этот метод для решения задания hCaptcha. Он возвращает JSON-ответ с указанными значениями: ответ (answer) и идентификатор задания (challenge_id).
318
+
319
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#lemin)</sup>
320
+
321
+ Используйте этот метод для решения задания Lemin. Он возвращает JSON-ответ с указанными значениями: ответ (answer) и идентификатор задания (challenge_id).
261
322
 
262
323
  ```ruby
263
324
  result = client.lemin({
@@ -270,6 +331,9 @@ result = client.lemin({
270
331
 
271
332
 
272
333
  ### Cloudflare Turnstile
334
+
335
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#turnstile)</sup>
336
+
273
337
  Используйте этот метод для решения задачи Cloudflare Turnstile. Он возвращает JSON с токеном.
274
338
 
275
339
  ```ruby
@@ -280,6 +344,9 @@ result = client.turnstile({
280
344
  ```
281
345
 
282
346
  ### Amazon WAF
347
+
348
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
349
+
283
350
  Используйте этот метод для решения Captcha Amazon WAF, также известного как AWS WAF Captcha, который является частью интеллектуальной защиты от угроз для Amazon AWS. Он возвращает JSON с токеном.
284
351
 
285
352
  ```ruby
@@ -293,27 +360,25 @@ result = client.amazon_waf({
293
360
  })
294
361
  ```
295
362
 
296
- ### GeeTest v4
297
- Используйте этот метод для решения GeeTest v4. Он возвращает ответ в формате JSON.
363
+ ### Распознавание аудио
298
364
 
299
- ```ruby
300
- result = client.geetest_v4({
301
- captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
302
- pageurl: 'https://www.site.com/page/'
303
- })
304
- ```
365
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#audio)</sup>
366
+
367
+ Этот метод можно использовать как для решения аудио капчи, так и для распознавания любой аудиозаписи.
305
368
 
306
- ### Audio
307
- Этот метод можно использовать для решения аудио-капчи.
369
+ Поддерживаемые языки: "en", "ru", "de", "el", "pt", "fr".
308
370
 
309
371
  ```ruby
310
372
  result = client.audio({
311
- audio: 'path/to/audio.jpg',
373
+ audio: 'path/to/audio.mp3',
312
374
  lang: "en"
313
375
  })
314
376
  ```
315
377
 
316
378
  ### CyberSiARA
379
+
380
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#cybersiara)</sup>
381
+
317
382
  Метод решения CyberSiARA. Он возвращает токен для обхода капчи.
318
383
 
319
384
  ```ruby
@@ -324,8 +389,13 @@ result = client.cyber_siara({
324
389
  ```
325
390
 
326
391
  ### DataDome
327
- Метод решения DataDome вернет токен для обхода капчи.
328
- Чтобы решить капчу DataDome вы должны обязательно использовать прокси.
392
+
393
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#datadome)</sup>
394
+
395
+ Метод решения DataDome вернет `cookies` для обхода капчи.
396
+
397
+ > [!IMPORTANT]
398
+ > Чтобы решить капчу DataDome вы должны обязательно использовать прокси. Рекомендуется использовать [резидентные прокси].
329
399
 
330
400
  ```ruby
331
401
  result = client.data_dome({
@@ -338,6 +408,9 @@ result = client.data_dome({
338
408
 
339
409
 
340
410
  ### MTCaptcha
411
+
412
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
413
+
341
414
  Метод решения MTCaptcha. Он возвращает токен для обхода капчи.
342
415
 
343
416
  ```ruby
@@ -349,8 +422,14 @@ result = client.mt_captcha({
349
422
 
350
423
 
351
424
  ### Friendly captcha
425
+
426
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
427
+
352
428
  Метод решения Friendly captcha. Он возвращает токен для обхода капчи.
353
429
 
430
+ > [!IMPORTANT]
431
+ > Чтобы успешно использовать полученный токен, виджет капчи не должен быть загружен на странице. Для этого необходимо прервать запрос к `/friendlycaptcha/...module.min.js` на странице. Если виджет капчи уже загружен на странице, существует высокая вероятность, что полученный токен не будет работать.
432
+
354
433
  ```ruby
355
434
  result = client.friendly({
356
435
  pageurl: "https://example.com",
@@ -358,8 +437,10 @@ result = client.friendly({
358
437
  })
359
438
  ```
360
439
 
361
-
362
440
  ### Cutcaptcha
441
+
442
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
443
+
363
444
  Метод решения Cutcaptcha. Он возвращает токен для обхода капчи.
364
445
 
365
446
  ```ruby
@@ -370,6 +451,31 @@ result = client.cutcaptcha({
370
451
  })
371
452
  ```
372
453
 
454
+ ### Tencent
455
+
456
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#tencent)</sup>
457
+
458
+ Основанный на токенах метод автоматизированного решения капчи Tencent.
459
+ ```ruby
460
+ result = client.tencent({
461
+ app_id: "197326679",
462
+ pageurl: "https://mysite.com/page/with/tencent"
463
+ })
464
+ ```
465
+
466
+ ### atbCAPTCHA
467
+
468
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
469
+
470
+ Основанный на токенах метод автоматизированного решения капчи atbCAPTCHA.
471
+ ```ruby
472
+ result = client.atb_captcha({
473
+ app_id: "197326679",
474
+ api_server: "api.atb_captcha.com",
475
+ pageurl: "https://mysite.com/page/with/atb_captcha"
476
+ })
477
+ ```
478
+
373
479
 
374
480
  ## Другие методы
375
481
 
@@ -395,6 +501,9 @@ time.sleep(20)
395
501
  result = client.get_result(captcha_id)
396
502
  ```
397
503
  ### Баланс
504
+
505
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#additional-methods)</sup>
506
+
398
507
  Используйте этот метод, чтобы посмотреть баланс в вашем аккаунте.
399
508
 
400
509
  ```ruby
@@ -402,6 +511,9 @@ balance = client.get_balance
402
511
  ```
403
512
 
404
513
  ### Отчет
514
+
515
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#complain)</sup>
516
+
405
517
  Используйте этот метод для отправки отчета о правильном или неправильном ответе на капчу.
406
518
 
407
519
  ```ruby
@@ -411,7 +523,7 @@ client.report(captcha_id, False) # капча решена неправильн
411
523
 
412
524
  ## Прокси
413
525
 
414
- Вы можете передать свой прокси-сервер в качестве дополнительного аргумента для методов: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, Cutcaptcha, Friendly captcha, MTCaptcha, DataDome, CyberSiARA и других. Передынный Прокси-сервер будет перенаправлен в API и будет использован для загрузки капчи.
526
+ Вы можете передать свой прокси-сервер в качестве дополнительного аргумента для методов: recaptcha, funcaptcha, geetest, geetest v4, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, Cutcaptcha, Friendly captcha, MTCaptcha, DataDome, CyberSiARA и других. Передынный Прокси-сервер будет перенаправлен в API и будет использован для загрузки капчи.
415
527
 
416
528
  У нас есть свои собственные прокси-серверы, которые мы можем вам предложить. [Купить резидентские прокси] чтобы избежать ограничений и блокировок. [Быстрый старт].
417
529
 
@@ -448,7 +560,32 @@ result = client.recaptcha_v2({
448
560
  end
449
561
  ```
450
562
 
563
+ ## Примеры
564
+
565
+ Примеры решения поддерживаемых типов капчи находятся в директории [examples].
566
+
567
+ ## Свяжитесь с нами
568
+
569
+ <a href="mailto:support@2captcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
570
+ <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>
571
+
572
+ <h2 id='join-the-team'>Присоединяйтесь к команде 👪</h2>
573
+
574
+ Есть много способов внести свой вклад, и разработка - лишь один из них! Найдите свою следующую работу. Открытые вакансии: AI experts, scrapers, developers, technical support, и многое другое! 😍
575
+
576
+ <a href="mailto:job@2captcha.com"><img src="https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033" width="80" height="30"></a>
577
+
578
+ ## Лицензия
579
+
580
+ Код в этом репозитории лицензируется по лицензии MIT. Более подробную информацию см. в файле [LICENSE](./LICENSE).
581
+
582
+ ### Графика и товарные знаки
583
+
584
+ Графика и товарные знаки, включенные в этот репозиторий, не подпадают под действие лицензии MIT. За разрешениями на использование этих материалов обращайтесь в <a href="mailto:support@2captcha.com">службу поддержки</a>.
585
+
451
586
  <!-- Shared links -->
452
587
  [2Captcha]: https://2captcha.com/
453
588
  [Купить резидентские прокси]: https://2captcha.com/proxy/residential-proxies
454
- [Быстрый старт]: https://2captcha.com/proxy?openAddTrafficModal=true
589
+ [Быстрый старт]: https://2captcha.com/proxy?openAddTrafficModal=true
590
+ [резидентные прокси]: https://2captcha.com/proxy/residential-proxies
591
+ [examples]: ./examples/
data/api_2captcha.gemspec CHANGED
@@ -18,6 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.metadata["source_code_uri"] = "https://github.com/2captcha/2captcha-ruby"
19
19
  spec.metadata["changelog_uri"] = "https://github.com/2captcha/2captcha-ruby/releases"
20
20
  spec.metadata["github_repo"] = "ssh://github.com/2captcha/2captcha-ruby"
21
+ spec.metadata["bug_tracker_uri"] = "https://github.com/2captcha/2captcha-ruby/issues"
22
+ spec.metadata["keywords"] = "2captcha, captcha solver, captcha bypass, Ruby, automation, CAPTCHA API, CAPTCHA recognition, anti-captcha, reCAPTCHA, OCR, image recognition, human verification, bot protection, recaptcha"
23
+
21
24
 
22
25
  # Specify which files should be added to the gem when it is released.
23
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -0,0 +1,11 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.atb_captcha({
6
+ app_id: "197326679",
7
+ api_server: "api.atb_captcha.com",
8
+ pageurl: "https://mysite.com/page/with/atb_captcha"
9
+ })
10
+
11
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,10 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.audio({
6
+ audio: './media/example.mp3',
7
+ lang: "en"
8
+ })
9
+
10
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,14 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.grid({
6
+ image: './media/recaptchaGrid4x4.jpg',
7
+ rows: 4,
8
+ cols: 4,
9
+ lang: 'en',
10
+ hint_image: './media/recaptchaGridImginstructions4x4.jpg',
11
+ # hint_text: 'Select all squares with stairs'
12
+ })
13
+
14
+ puts "Result: #{result.inspect}"
Binary file
Binary file
Binary file
@@ -0,0 +1,9 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.normal({
6
+ image: './media/normal_2.jpg',
7
+ })
8
+
9
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,10 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.recaptcha_v2({
6
+ googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
7
+ pageurl: 'https://2captcha.com/demo/recaptcha-v2',
8
+ })
9
+
10
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,10 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.tencent({
6
+ app_id: "197326679",
7
+ pageurl: "https://mysite.com/page/with/tencent"
8
+ })
9
+
10
+ puts "Result: #{result.inspect}"
@@ -134,7 +134,7 @@ module Api2Captcha
134
134
  end
135
135
 
136
136
  def grid(params)
137
- params["recaptcha"] = 1
137
+ params[:recaptcha] = 1
138
138
  solve("post", **params)
139
139
  end
140
140
 
@@ -171,7 +171,7 @@ module Api2Captcha
171
171
  end
172
172
 
173
173
  def audio(params)
174
- audio = params.delete("audio")
174
+ audio = params.delete(:audio)
175
175
  audio_content = File.file?(audio) ? File.binread(audio) : audio
176
176
 
177
177
  params = params.merge(
@@ -205,6 +205,14 @@ module Api2Captcha
205
205
  solve("cutcaptcha", **params)
206
206
  end
207
207
 
208
+ def tencent(params)
209
+ solve("tencent", **params)
210
+ end
211
+
212
+ def atb_captcha(params)
213
+ solve("atb_captcha", **params)
214
+ end
215
+
208
216
  private
209
217
 
210
218
  def base_url
@@ -227,16 +235,24 @@ module Api2Captcha
227
235
  image = params.delete("image")
228
236
  hint_image = params.delete("hint_image")
229
237
 
230
- image_content = get_image_content(image)
231
- hint_image_content = get_image_content(hint_image) if hint_image
238
+ image_content = if base64_encoded?(image)
239
+ image
240
+ else
241
+ Base64.strict_encode64(get_image_content(image))
242
+ end
243
+
244
+ hint_image_content = if hint_image
245
+ base64_encoded?(hint_image) ? hint_image : Base64.strict_encode64(get_image_content(hint_image))
246
+ end
247
+
232
248
  result_params = {
233
249
  "method" => "base64",
234
- "body" => Base64.strict_encode64(image_content),
250
+ "body" => image_content,
235
251
  "filename" => File.basename(image),
236
252
  "ext" => File.extname(image).delete(".")
237
253
  }
238
254
 
239
- result_params["imginstructions"] = Base64.strict_encode64(hint_image_content) if hint_image_content
255
+ result_params["imginstructions"] = hint_image_content if hint_image_content
240
256
  params.merge(result_params)
241
257
  end
242
258
 
@@ -246,6 +262,10 @@ module Api2Captcha
246
262
  image
247
263
  end
248
264
 
265
+ def base64_encoded?(string)
266
+ string.is_a?(String) && string.match(/\A[A-Za-z0-9+\/=]+\z/) && (string.length % 4).zero?
267
+ end
268
+
249
269
  def download_image(url)
250
270
  response = URI.open(url)
251
271
  if response.status[0] != '200'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Api2Captcha
4
- VERSION = "1.1.5"
4
+ VERSION = "1.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-2captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2captcha.com
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-16 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby package for easy integration with the API of 2captcha captcha solving
14
14
  service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
@@ -29,6 +29,16 @@ files:
29
29
  - README.ru.md
30
30
  - Rakefile
31
31
  - api_2captcha.gemspec
32
+ - examples/atb_captcha_example.rb
33
+ - examples/audio_example.rb
34
+ - examples/grid_captcha_example.rb
35
+ - examples/media/example.mp3
36
+ - examples/media/normal_2.jpg
37
+ - examples/media/recaptchaGrid4x4.jpg
38
+ - examples/media/recaptchaGridImginstructions4x4.jpg
39
+ - examples/normal_captcha_example.rb
40
+ - examples/recaptcha_v2_example.rb
41
+ - examples/tencent_example.rb
32
42
  - lib/api_2captcha.rb
33
43
  - lib/api_2captcha/api2captcha_exceptions.rb
34
44
  - lib/api_2captcha/client.rb
@@ -42,6 +52,10 @@ metadata:
42
52
  source_code_uri: https://github.com/2captcha/2captcha-ruby
43
53
  changelog_uri: https://github.com/2captcha/2captcha-ruby/releases
44
54
  github_repo: ssh://github.com/2captcha/2captcha-ruby
55
+ bug_tracker_uri: https://github.com/2captcha/2captcha-ruby/issues
56
+ keywords: 2captcha, captcha solver, captcha bypass, Ruby, automation, CAPTCHA API,
57
+ CAPTCHA recognition, anti-captcha, reCAPTCHA, OCR, image recognition, human verification,
58
+ bot protection, recaptcha
45
59
  post_install_message:
46
60
  rdoc_options: []
47
61
  require_paths: