solvecaptcha-ruby 1.0.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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +43 -0
  3. data/CONTRIBUTING.md +72 -0
  4. data/Gemfile +14 -0
  5. data/LICENSE +21 -0
  6. data/README.md +640 -0
  7. data/RELEASING.md +16 -0
  8. data/Rakefile +12 -0
  9. data/api_solvecaptcha.gemspec +39 -0
  10. data/examples/amazon_waf_example.rb +7 -0
  11. data/examples/atb_captcha_example.rb +11 -0
  12. data/examples/audio_example.rb +10 -0
  13. data/examples/canvas_example.rb +7 -0
  14. data/examples/capy_example.rb +7 -0
  15. data/examples/clickcaptcha_example.rb +7 -0
  16. data/examples/cutcaptcha_example.rb +7 -0
  17. data/examples/cybersiara_example.rb +7 -0
  18. data/examples/datadome_example.rb +7 -0
  19. data/examples/friendlycaptcha_example.rb +7 -0
  20. data/examples/funcaptcha_example.rb +7 -0
  21. data/examples/geetest_example.rb +7 -0
  22. data/examples/geetest_v4_example.rb +7 -0
  23. data/examples/grid_captcha_example.rb +14 -0
  24. data/examples/hcaptcha_example.rb +10 -0
  25. data/examples/keycaptcha_example.rb +7 -0
  26. data/examples/lemin_example.rb +7 -0
  27. data/examples/media/example.mp3 +0 -0
  28. data/examples/media/normal_2.jpg +0 -0
  29. data/examples/media/recaptchaGrid4x4.jpg +0 -0
  30. data/examples/media/recaptchaGridImginstructions4x4.jpg +0 -0
  31. data/examples/mtcaptcha_example.rb +7 -0
  32. data/examples/normal_captcha_example.rb +15 -0
  33. data/examples/recaptcha_enterprise_example.rb +7 -0
  34. data/examples/recaptcha_v2_example.rb +10 -0
  35. data/examples/recaptcha_v3_example.rb +7 -0
  36. data/examples/rotate_example.rb +7 -0
  37. data/examples/tencent_example.rb +10 -0
  38. data/examples/turnstile_example.rb +7 -0
  39. data/examples/yandex_smart_example.rb +7 -0
  40. data/lib/api_solvecaptcha/api_solvecaptcha_exceptions.rb +25 -0
  41. data/lib/api_solvecaptcha/client.rb +166 -0
  42. data/lib/api_solvecaptcha/version.rb +5 -0
  43. data/lib/api_solvecaptcha.rb +13 -0
  44. metadata +93 -0
data/README.md ADDED
@@ -0,0 +1,640 @@
1
+ ![ruby](https://github.com/user-attachments/assets/64522815-dd7c-4bdf-8944-1904b83c8299)
2
+
3
+ <a href="https://github.com/solvercaptcha/solvecaptcha-python"><img src="https://github.com/user-attachments/assets/37e1d860-033b-4cf3-a158-468fc6b4debc" width="82" height="30"></a>
4
+ <a href="https://github.com/solvercaptcha/solvecaptcha-javascript"><img src="https://github.com/user-attachments/assets/4d3b4541-34b2-4ed2-a687-d694ce67e5a6" width="36" height="30"></a>
5
+ <a href="https://github.com/solvercaptcha/solvecaptcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
6
+ <a href="https://github.com/solvercaptcha/solvecaptcha-ruby"><img src="https://github.com/user-attachments/assets/1c3b6dc2-9acd-44fe-927d-31de3427639f" width="75" height="30"></a>
7
+ <a href="https://github.com/solvercaptcha/solvecaptcha-cpp"><img src="https://github.com/user-attachments/assets/36de8512-acfd-44fb-bb1f-b7c793a3f926" width="45" height="30"></a>
8
+ <a href="https://github.com/solvercaptcha/solvecaptcha-php"><img src="https://github.com/user-attachments/assets/e8797843-3f61-4fa9-a155-ab0b21fb3858" width="52" height="30"></a>
9
+ <a href="https://github.com/solvercaptcha/solvecaptcha-java"><img src="https://github.com/user-attachments/assets/a3d923f6-4fec-4c07-ac50-e20da6370911" width="50" height="30"></a>
10
+ <a href="https://github.com/solvercaptcha/solvecaptcha-csharp"><img src="https://github.com/user-attachments/assets/f4d449de-780b-49ed-bb0a-b70c82ec4b32" width="38" height="30"></a>
11
+
12
+ # 💎 Ruby captcha solver: Bypass reCAPTCHA, Cloudflare, hCaptcha, Amazon and more
13
+
14
+ Use the [Ruby captcha solver](https://solvecaptcha.com/captcha-solver/ruby-captcha-solver-bypass) to automatically bypass captchas like reCAPTCHA v2, v3, Invisible, Enterprise, hCaptcha, Cloudflare Turnstile, GeeTest, FunCaptcha, and Amazon WAF in any Ruby app.
15
+
16
+ ## ✅ Supported captcha solvers
17
+
18
+ To get started quickly, check out the [Captcha Solver API](https://solvecaptcha.com/captcha-solver-api) documentation.
19
+
20
+ Helpful links:
21
+ - [reCAPTCHA v2 solver](https://solvecaptcha.com/captcha-solver/recaptcha-v2-solver-bypass)
22
+ - [reCAPTCHA v3 solver](https://solvecaptcha.com/captcha-solver/recaptcha-v3-solver-bypass)
23
+ - [hCaptcha solver](https://solvecaptcha.com/captcha-solver/hcaptcha-solver-bypass)
24
+ - [Text and image captcha solver](https://solvecaptcha.com/captcha-solver/image-captcha-solver-bypass)
25
+ - [Cloudflare captcha solver (Turnstile)](https://solvecaptcha.com/captcha-solver/cloudflare-captcha-solver-bypass)
26
+ - [Amazon captcha solver (AWS WAF)](https://solvecaptcha.com/captcha-solver/amazon-captcha-solver-bypass)
27
+ - [GeeTest solver](https://solvecaptcha.com/captcha-solver/slider-captcha-solver-bypass)
28
+ - [FunCaptcha (Arkose Labs) solver](https://solvecaptcha.com/captcha-solver/funcaptcha-solver-bypass)
29
+ - [Other types](https://solvecaptcha.com/)
30
+
31
+ ### 🛠️ Features
32
+ - Fast and fully automated captcha solving
33
+ - Native support for **Go 1.18+**
34
+ - Uses standard `net/http` and JSON APIs — no external dependencies
35
+ - Easy integration with any Go backend, CLI tool, or scraper
36
+ - Supports async solving via goroutines and channels
37
+ - Pay only for successful solves
38
+ - 99.9% uptime
39
+ - 24/7 developer support
40
+
41
+ ### 📦 Use cases
42
+ - Accessibility automation
43
+ - Web scraping
44
+ - Automating form submissions in Go-powered services
45
+ - Running solvers in goroutines or background jobs
46
+ - QA pipelines and headless test automation
47
+ - Security testing and bot protection research
48
+
49
+ Need help integrating with your PHP application? [Open an issue](https://github.com/solvercaptcha/solvecaptcha-ruby/issues) or fork this repo to contribute.
50
+
51
+ - [💎 Ruby captcha solver: Bypass reCAPTCHA, Cloudflare, hCaptcha, Amazon and more](#-ruby-captcha-solver-bypass-recaptcha-cloudflare-hcaptcha-amazon-and-more)
52
+ - [Installation](#installation)
53
+ - [Configuration](#configuration)
54
+ - [Client instance options](#client-instance-options)
55
+ - [Solve captcha](#solve-captcha)
56
+ - [Captcha options](#captcha-options)
57
+ - [Normal Captcha](#normal-captcha)
58
+ - [Text Captcha](#text-captcha)
59
+ - [reCAPTCHA v2](#recaptcha-v2)
60
+ - [reCAPTCHA v3](#recaptcha-v3)
61
+ - [reCAPTCHA Enterprise](#recaptcha-enterprise)
62
+ - [hCaptcha](#hcaptcha)
63
+ - [FunCaptcha](#funcaptcha)
64
+ - [GeeTest](#geetest)
65
+ - [GeeTest V4](#geetest-v4)
66
+ - [KeyCaptcha](#keycaptcha)
67
+ - [Capy](#capy)
68
+ - [Grid](#grid)
69
+ - [Canvas](#canvas)
70
+ - [ClickCaptcha](#clickcaptcha)
71
+ - [Rotate](#rotate)
72
+ - [Amazon WAF](#amazon-waf)
73
+ - [Cloudflare Turnstile](#cloudflare-turnstile)
74
+ - [Lemin Cropped Captcha](#lemin-cropped-captcha)
75
+ - [Audio Captcha](#audio-captcha)
76
+ - [Yandex](#yandex)
77
+ - [CyberSiARA](#cybersiara)
78
+ - [DataDome](#datadome)
79
+ - [MTCaptcha](#mtcaptcha)
80
+ - [Friendly captcha](#friendly-captcha)
81
+ - [Cutcaptcha](#cutcaptcha)
82
+ - [Tencent](#tencent)
83
+ - [atbCAPTCHA](#atbcaptcha)
84
+ - [Other methods](#other-methods)
85
+ - [send / get_result](#send--get_result)
86
+ - [balance](#balance)
87
+ - [report](#report)
88
+ - [Proxies](#proxies)
89
+ - [Error handling](#error-handling)
90
+ - [Examples](#examples)
91
+ - [Get in touch](#get-in-touch)
92
+ - [License](#license)
93
+
94
+
95
+ ## Installation
96
+
97
+ Add this line to your Gemfile:
98
+
99
+ ```ruby
100
+ gem 'solvecaptcha', git: 'https://github.com/solvercaptcha/solvecaptcha-ruby.git'
101
+ ```
102
+
103
+ Then run:
104
+
105
+ ```bash
106
+ bundle install
107
+ ```
108
+
109
+ Or install it manually with:
110
+
111
+ ```bash
112
+ gem install specific_install
113
+ gem specific_install https://github.com/solvercaptcha/solvecaptcha-ruby.git
114
+ ```
115
+
116
+
117
+ ## Installation
118
+ Add this line to your application's Gemfile:
119
+
120
+ ```bash
121
+ gem 'ruby-solvecaptcha'
122
+ ```
123
+
124
+ And then execute:
125
+
126
+ ```bash
127
+ $ bundle
128
+ ```
129
+ Or install it yourself as:
130
+
131
+ ```bash
132
+ $ gem install ruby-solvecaptcha
133
+ ```
134
+
135
+ ## Configuration
136
+ To use the ApiSolveCaptcha gem, you'll need to import the module and create a Client instance. Here's an example:
137
+
138
+ ```ruby
139
+ require_relative '../lib/api_solvecaptcha'
140
+
141
+ client = ApiSolveCaptcha.new("YOUR_API_KEY")
142
+ ```
143
+
144
+ There are a few options that can be configured using the Client instance:
145
+
146
+ ```ruby
147
+ client.api_key = "YOUR_API_KEY"
148
+ ```
149
+
150
+ ### Client instance options
151
+
152
+ |Option |Default value|Description |
153
+ |----------------|-------------|------------------------------------------------------------------------|
154
+ |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|
155
+ |polling_interval|10 |Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended|
156
+
157
+ To get the answer manually use [get_result method](#send--get_result)
158
+
159
+ ## Solve captcha
160
+ When you submit any image-based captcha use can provide additional options to help solvecaptcha workers to solve it properly.
161
+
162
+ ### Captcha options
163
+ | Option | Default Value | Description |
164
+ | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
165
+ | numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][normal_post] |
166
+ | min_len | 0 | minimal answer lenght |
167
+ | max_len | 0 | maximum answer length |
168
+ | phrase | 0 | defines if the answer contains multiple words or not |
169
+ | case_sensitive| 0 | defines if the answer is case sensitive |
170
+ | calc | 0 | defines captcha requires calculation |
171
+ | lang | - | defines the captcha language, see the [list of supported languages] |
172
+ | hint_image | - | an image with hint shown to workers with the captcha, translated into instructionsimg API parameter |
173
+ | hint_text | - | hint or task text shown to workers with the captcha |
174
+
175
+ Below you can find basic examples for every captcha type, check out the code below.
176
+
177
+ ### Normal Captcha
178
+
179
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_normal_captcha)</sup>
180
+
181
+ 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.
182
+ ```ruby
183
+ result = client.normal({ image: 'path/to/captcha.jpg'})
184
+ # OR
185
+ result = client.normal({
186
+ image: 'https://site-with-captcha.com/path/to/captcha.jpg'
187
+ })
188
+ ```
189
+
190
+ ### Text Captcha
191
+
192
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_text_captcha)</sup>
193
+
194
+ This method can be used to bypass a captcha that requires to answer a question provided in clear text.
195
+ ```ruby
196
+ result = client.text({
197
+ textcaptcha:'If tomorrow is Saturday, what day is today?',
198
+ lang: "en"
199
+ })
200
+ ```
201
+
202
+ ### reCAPTCHA v2
203
+
204
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_recaptchav2_new)</sup>
205
+
206
+ Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
207
+ ```ruby
208
+ result = client.recaptcha_v2({
209
+ googlekey: '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
210
+ pageurl: 'https://mysite.com/page/with/recaptcha_v2',
211
+ invisible: 1
212
+ })
213
+ ```
214
+
215
+ ### reCAPTCHA v3
216
+
217
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_recaptchav3)</sup>
218
+
219
+ This method provides reCAPTCHA V3 solver and returns a token.
220
+ ```ruby
221
+ result = client.recaptcha_v3({
222
+ googlekey: '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
223
+ pageurl: 'https://mysite.com/page/with/recaptcha_v3',
224
+ version: 'v3',
225
+ score: 0.3,
226
+ action: 'verify'
227
+ })
228
+ ```
229
+
230
+ ### reCAPTCHA Enterprise
231
+
232
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_recaptcha_enterprise)</sup>
233
+
234
+ reCAPTCHA Enterprise can be used as reCAPTCHA V2 and reCAPTCHA V3. Below is a usage example for both versions.
235
+
236
+ ```ruby
237
+ # reCAPTCHA V2
238
+ result = client.recaptcha_v2({
239
+ googlekey: '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
240
+ pageurl: 'https://mysite.com/page/with/recaptcha_v2_enterprise',
241
+ enterprise: 1
242
+ })
243
+
244
+ # reCAPTCHA V3
245
+ result = client.recaptcha_v3({
246
+ googlekey: '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
247
+ pageurl: 'https://mysite.com/page/with/recaptcha_v3_enterprise',
248
+ version: 'v3',
249
+ score: 0.3,
250
+ action: 'verify',
251
+ enterprise: 1,
252
+ })
253
+ ```
254
+
255
+ ### hCaptcha
256
+
257
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_hcaptcha)</sup>
258
+
259
+ Use this method to solve hCaptcha and obtain a token to bypass the protection.
260
+
261
+ ```ruby
262
+ result = client.hcaptcha({
263
+ sitekey: 'SITEKEY',
264
+ pageurl: 'https://example.com'
265
+ })
266
+ ```
267
+
268
+ ### FunCaptcha
269
+
270
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_funcaptcha_new)</sup>
271
+
272
+ FunCaptcha (Arkoselabs) solving method. Returns a token.
273
+
274
+ ```ruby
275
+ result = client.funcaptcha({
276
+ publickey: "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
277
+ pageurl: "https://mysite.com/page/with/funcaptcha",
278
+ surl: "https://client-api.arkoselabs.com"})
279
+ ```
280
+
281
+ ### GeeTest
282
+
283
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_geetest)</sup>
284
+
285
+ Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
286
+ ```ruby
287
+ result = client.geetest({
288
+ gt: 'f1ab2cdefa3456789012345b6c78d90e',
289
+ api_server: 'api-na.geetest.com',
290
+ challenge: '12345678abc90123d45678ef90123a456b',
291
+ pageurl: 'https://www.site.com/page/'
292
+ })
293
+ ```
294
+
295
+ ### GeeTest v4
296
+
297
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_geetest_v4)</sup>
298
+
299
+ Use this method to solve GeeTest v4. Returns the response in JSON.
300
+ ```ruby
301
+ result = client.geetest_v4({
302
+ captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73',
303
+ pageurl: 'https://www.site.com/page/'
304
+ })
305
+ ```
306
+
307
+ ### KeyCaptcha
308
+
309
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_keycaptcha)</sup>
310
+
311
+ Token-based method to solve KeyCaptcha.
312
+ ```ruby
313
+ result = client.keycaptcha({
314
+ s_s_c_user_id: 10,
315
+ s_s_c_session_id: '493e52c37c10c2bcdf4a00cbc9ccd1e8',
316
+ s_s_c_web_server_sign: '9006dc725760858e4c0715b835472f22-pz-',
317
+ s_s_c_web_server_sign2: '2ca3abe86d90c6142d5571db98af6714',
318
+ pageurl: 'https://www.keycaptcha.ru/demo-magnetic/'
319
+ })
320
+ ```
321
+
322
+ ### Capy
323
+
324
+ Token-based method to bypass Capy puzzle captcha.
325
+ ```ruby
326
+ result = client.capy({
327
+ sitekey: 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
328
+ pageurl: 'http://mysite.com/',
329
+ api_server: 'https://jp.api.capy.me/'
330
+ })
331
+ ```
332
+
333
+ ### Grid
334
+
335
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_grid)</sup>
336
+
337
+ 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.
338
+ ```ruby
339
+ result = client.grid({
340
+ image: 'path/to/captcha.jpg',
341
+ recaptcharows: 3,
342
+ recaptchacols: 3,
343
+ previous_id: 0,
344
+ lang: 'en',
345
+ imginstructions: 'path/to/hint.jpg',
346
+ textinstructions: 'Select all images with an Orange'
347
+ })
348
+ ```
349
+
350
+ ### Canvas
351
+
352
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#canvas)</sup>
353
+
354
+ 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.
355
+ ```ruby
356
+ result = client.canvas({
357
+ image: 'path/to/captcha.jpg',
358
+ previous_id: 0,
359
+ lang: 'en',
360
+ hint_image: 'path/to/hint.jpg',
361
+ hint_text: 'Draw around apple'
362
+ })
363
+ ```
364
+
365
+ ### ClickCaptcha
366
+
367
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_rotatecaptcha)</sup>
368
+
369
+ ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.
370
+ ```ruby
371
+ result = client.coordinates({
372
+ image: 'path/to/captcha.jpg',
373
+ lang: 'en',
374
+ hint_image: 'path/to/hint.jpg',
375
+ hint_text: 'Connect the dots'
376
+ })
377
+ ```
378
+
379
+ ### Rotate
380
+
381
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_rotatecaptcha)</sup>
382
+
383
+ This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
384
+ ```ruby
385
+ result = client.rotate({
386
+ image: 'path/to/captcha.jpg',
387
+ angle: 40,
388
+ lang: 'en',
389
+ hint_image: 'path/to/hint.jpg',
390
+ hint_text: 'Put the images in the correct way'
391
+ })
392
+ ```
393
+
394
+ ### Lemin Cropped Captcha
395
+
396
+ Use this method to solve Lemin challenge. Returns JSON with answer containing the following values: answer, challenge_id.
397
+ ```ruby
398
+ result = client.lemin({
399
+ captcha_id: 'CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
400
+ div_id: 'lemin-cropped-captcha',
401
+ pageurl: 'https://www.site.com/page/',
402
+ api_server: "https://api.leminnow.com/"
403
+ })
404
+ ```
405
+
406
+ ### Cloudflare Turnstile
407
+
408
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#solving_cloudflare_turnstile)</sup>
409
+
410
+ Use this method to solve Cloudflare Turnstile. Returns JSON with the token and User-Agent.
411
+ ```ruby
412
+ result = client.turnstile({
413
+ sitekey: "0x0AAAAAAADnPIDROzbs0Aaj",
414
+ data: "7fab0000b0e0ff00",
415
+ pagedata: "3gAFo2...0ME1UVT0=",
416
+ pageurl: "https://solvecaptcha.com/",
417
+ action: "managed",
418
+ userAgent: "Mozilla/5.0 ... Chrome/116.0.0.0 Safari/537.36",
419
+ json: 1
420
+ })
421
+ ```
422
+
423
+ ### Amazon WAF
424
+
425
+ 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.
426
+
427
+ ```ruby
428
+ result = client.amazon_waf({
429
+ sitekey: '0x1AAAAAAAAkg0s2VIOD34y5',
430
+ iv: 'CgAHbCe2GgAAAAAj',
431
+ context: '9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc=',
432
+ pageurl: 'https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest',
433
+ challenge_script: "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js",
434
+ captcha_script: "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js"
435
+ })
436
+ ```
437
+
438
+ ### Audio Captcha
439
+
440
+ Use the following method to bypass an audio captcha (mp3 formats only).
441
+ You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
442
+ ```ruby
443
+ result = client.audio({
444
+ audio: 'path/to/audio.mp3',
445
+ lang: "en"
446
+ })
447
+ ```
448
+
449
+ ### Yandex
450
+
451
+ Use this method to solve Yandex and obtain a token to bypass the protection.
452
+
453
+ ```ruby
454
+ result = client.yandex({
455
+ sitekey: 'Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV',
456
+ url: "https://rutube.ru"
457
+ })
458
+ ```
459
+
460
+ ### CyberSiARA
461
+
462
+ Use this method to solve CyberSiARA and obtain a token to bypass the protection.
463
+ ```ruby
464
+ result = client.cyber_siara({
465
+ pageurl: "https://test.com",
466
+ master_url_id: "12333-3123123"
467
+ })
468
+ ```
469
+
470
+ ### DataDome
471
+
472
+ Use this method to solve DataDome and obtain a token to bypass the protection.
473
+
474
+ > [!IMPORTANT]
475
+ > To solve the DataDome captcha, you must use a proxy. It is recommended to use residential proxies.
476
+
477
+ ```ruby
478
+ result = client.data_dome({
479
+ pageurl: "https://test.com",
480
+ captcha_url: "https://test.com/captcha/",
481
+ proxytype: "http",
482
+ proxy: "proxyuser:strongPassword@123.123.123.123:3128"
483
+ })
484
+ ```
485
+
486
+ ### MTCaptcha
487
+
488
+ Use this method to solve MTCaptcha and obtain a token to bypass the protection.
489
+ ```ruby
490
+ result = client.mt_captcha({
491
+ pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
492
+ sitekey: "MTPublic-DemoKey9M"
493
+ })
494
+ ```
495
+
496
+ ### Friendly captcha
497
+
498
+ Use this method to solve Friendly captcha and obtain a token to bypass the protection.
499
+
500
+ > [!IMPORTANT]
501
+ > 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.
502
+
503
+ ```ruby
504
+ result = client.friendly({
505
+ pageurl: "https://example.com",
506
+ sitekey: "2FZFEVS1FZCGQ9"
507
+ })
508
+ ```
509
+
510
+ ### Cutcaptcha
511
+
512
+ Use this method to solve Cutcaptcha and obtain a token to bypass the protection.
513
+ ```ruby
514
+ result = client.cutcaptcha({
515
+ misery_key: "a1488b66da00bf332a1488993a5443c79047e752",
516
+ api_key: "SAb83IIB",
517
+ pageurl: "https://example.cc/foo/bar.html"
518
+ })
519
+ ```
520
+
521
+ ### Tencent
522
+
523
+ Token-based method for automated solving of Tencent captcha.
524
+ ```ruby
525
+ result = client.tencent({
526
+ app_id: "197326679",
527
+ pageurl: "https://mysite.com/page/with/tencent"
528
+ })
529
+ ```
530
+
531
+ ### atbCAPTCHA
532
+
533
+ Token-based method for automated solving of atbCAPTCHA.
534
+ ```ruby
535
+ result = client.atb_captcha({
536
+ app_id: "197326679",
537
+ api_server: "api.atb_captcha.com",
538
+ pageurl: "https://mysite.com/page/with/atb_captcha"
539
+ })
540
+ ```
541
+
542
+ ## Other methods
543
+
544
+ ### send / get_result
545
+
546
+ These methods can be used for manual captcha submission and answer polling.
547
+ ```ruby
548
+
549
+ # example for normal captcha
550
+ captcha_id = client.send('path/to/captcha.jpg')
551
+
552
+ # or for another captcha, for example for lemin
553
+ captcha_id = client.send({
554
+ method:"lemin",
555
+ captcha_id: "CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b",
556
+ api_server: "api.leminnow.com",
557
+ div_id: "lemin-cropped-captcha",
558
+ pageurl: "https://www.site.com/page/"
559
+ })
560
+
561
+ time.sleep(20)
562
+
563
+ # Get result
564
+ result = client.get_result(captcha_id)
565
+ ```
566
+
567
+ ### balance
568
+
569
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#additional)</sup>
570
+
571
+ Use this method to get your account's balance
572
+
573
+ ```ruby
574
+ balance = client.get_balance
575
+ ```
576
+
577
+ ### report
578
+
579
+ <sup>[API method description.](https://solvecaptcha.com/captcha-solver-api#complain)</sup>
580
+
581
+ Use this method to report good or bad captcha answer.
582
+ ```ruby
583
+ client.report(captcha_id, True) # captcha solved correctly
584
+ client.report(captcha_id, False) # captcha solved incorrectly
585
+ ```
586
+ ## Proxies
587
+
588
+ 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.
589
+
590
+ Example solving reCAPTCHA V2 using proxy:
591
+ ```ruby
592
+ result = client.recaptcha_v2({
593
+ googlekey: '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
594
+ pageurl: 'https://mysite.com/page/with/recaptcha_v2',
595
+ invisible: 1,
596
+ proxytype: "https",
597
+ proxy: "proxyuser:strongPassword@123.123.123.123:3128"
598
+ })
599
+ ```
600
+
601
+ ## Error handling
602
+ In case of an error, the captcha solver throws an exception. It's important to properly handle these cases. We recommend using `begin rescue` to handle exceptions.
603
+ ```ruby
604
+ begin
605
+ result = client.text('If tomorrow is Saturday, what day is today?')
606
+ rescue ApiSolveCaptcha::ValidationException => e
607
+ # invalid parameters passed
608
+ puts(e)
609
+ rescue ApiSolveCaptcha::NetworkException => e
610
+ # network error occurred
611
+ puts(e)
612
+ rescue ApiSolveCaptcha::ApiException => e
613
+ # api respond with error
614
+ puts(e)
615
+ rescue ApiSolveCaptcha::TimeoutException => e
616
+ # captcha is not solved so far
617
+ puts(e)
618
+ end
619
+ ```
620
+
621
+ ## Examples
622
+
623
+ Examples of solving all supported captcha types are located in the [examples] directory.
624
+
625
+ ## Get in touch
626
+
627
+ <a href="mailto:info@solvecaptcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
628
+ <a href="https://solvecaptcha.com/support/faq#create-ticket"><img src="https://github.com/user-attachments/assets/be044db5-2e67-46c6-8c81-04b78bd99650" width="81" height="30"></a>
629
+
630
+
631
+ ## License
632
+
633
+ The code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
634
+
635
+ <!-- Shared links -->
636
+ [SolveCaptcha]: https://solvecaptcha.com/
637
+ [normal_post]: https://solvecaptcha.com/captcha-solver-api#normal_post
638
+ [list of supported languages]: https://solvecaptcha.com/solvecaptcha-api#language
639
+ [examples]: ./examples/
640
+
data/RELEASING.md ADDED
@@ -0,0 +1,16 @@
1
+ # Release Guide
2
+
3
+ 1. Bump version in `lib/api_solvecaptcha/version.rb` to `X.Y.Z`.
4
+ 2. Commit changes:
5
+ ```bash
6
+ git commit -am "Bump to vX.Y.Z"
7
+ ```
8
+ 3. Create and annotate tag:
9
+ ```bash
10
+ git tag -a vX.Y.Z -m "Release vX.Y.Z"
11
+ ```
12
+ 4. Push code and tag:
13
+ ```bash
14
+ git push origin main --tags
15
+ ```
16
+ 5. GitHub Actions will build and publish automatically.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]