ruby-2captcha 1.1.6 → 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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec_status +16 -7
  3. data/.ruby-version +1 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.md +198 -4
  6. data/README.ru.md +203 -0
  7. data/api_2captcha.gemspec +1 -1
  8. data/examples/alibaba_example.rb +16 -0
  9. data/examples/altcha_example.rb +12 -0
  10. data/examples/amazon_waf_example.rb +14 -0
  11. data/examples/basilisk_example.rb +15 -0
  12. data/examples/binance_example.rb +17 -0
  13. data/examples/canvas_example.rb +13 -0
  14. data/examples/captchafox_example.rb +20 -0
  15. data/examples/capy_example.rb +11 -0
  16. data/examples/cloudflare_turnstile_example.rb +15 -0
  17. data/examples/coordinates_example.rb +12 -0
  18. data/examples/cut_captcha_example.rb +11 -0
  19. data/examples/cyber_siara_example.rb +10 -0
  20. data/examples/datadome_example.rb +12 -0
  21. data/examples/drag_drop_example.rb +24 -0
  22. data/examples/friendly_captcha_example.rb +10 -0
  23. data/examples/funcaptcha_example.rb +10 -0
  24. data/examples/geetest_example.rb +12 -0
  25. data/examples/geetest_v4_example.rb +10 -0
  26. data/examples/hcaptcha_example.rb +10 -0
  27. data/examples/hunt_example.rb +17 -0
  28. data/examples/key_captcha_example.rb +13 -0
  29. data/examples/lemin_example.rb +12 -0
  30. data/examples/media/drag_drop/background.jpeg +0 -0
  31. data/examples/media/drag_drop/image1.jpeg +0 -0
  32. data/examples/media/drag_drop/image2.jpeg +0 -0
  33. data/examples/media/temu/body.png +0 -0
  34. data/examples/media/temu/part1.png +0 -0
  35. data/examples/media/temu/part2.png +0 -0
  36. data/examples/media/temu/part3.png +0 -0
  37. data/examples/mt_captcha_example.rb +10 -0
  38. data/examples/normal_captcha_example.rb +4 -2
  39. data/examples/prosopo_example.rb +16 -0
  40. data/examples/recaptcha_v2_example.rb +1 -1
  41. data/examples/recaptcha_v3_example.rb +18 -0
  42. data/examples/rotate_example.rb +13 -0
  43. data/examples/temu_example.rb +28 -0
  44. data/examples/text_example.rb +10 -0
  45. data/examples/tspd_example.rb +19 -0
  46. data/examples/vkcaptcha_example.ru +10 -0
  47. data/examples/vkimage_example.rb +10 -0
  48. data/examples/yandex_example.rb +10 -0
  49. data/examples/yidun_example.rb +15 -0
  50. data/howto.txt +8 -0
  51. data/lib/api_2captcha/client.rb +53 -1
  52. data/lib/api_2captcha/version.rb +1 -1
  53. metadata +48 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3cf34c705f05cac002afa61dbfe4ded7b7e1f07a579fa0d2e98c52ec1972ebc
4
- data.tar.gz: 7aeb0c18eb4f7136278ef3ab528312eced958cd4ef1ebd2ee33a44296e4ed416
3
+ metadata.gz: 8d43df532b2141353e6422da8e0665393eb50e141146845a1c29626588c4dd68
4
+ data.tar.gz: d8ebb3b307406598dc10d828a7263f3a31d703fde4f9e2c0ed0dce362beddb8d
5
5
  SHA512:
6
- metadata.gz: c092dcb03fc11e1de8aff2a41b7b1b8908ee19e66dd643d8aaf4dd12cdab9d920e68a60b6f63c55e6ea9271b93f8b9d54aa3ea1d0991e8f11ae9cbad48d1b813
7
- data.tar.gz: 7c42d06519aa623dcf5652d036bc85864f1df0725d913c3c7be2d3be2f7b8502367ed802ccba7f3908a3f2bf711840a50e36a54c53b4a35df0b9699cb008fc4b
6
+ metadata.gz: f0a5795f465569fdbede1fec84f74f1d65ba0a1cdc7adf93021b4feb11cfc22b377330c4ac7a2574e5dceffc6358106d64ed0a518375370a3a56b52a3ecbbbda
7
+ data.tar.gz: a979fff1899841066c9d2898ae0c6e56bd2725221ca1542cd5b4f040f9e7b48fe491fc4c7f51dc41f61565ab041fb986260a2fda6879f6296df69d116a6cf6f7
data/.rspec_status CHANGED
@@ -1,7 +1,16 @@
1
- example_id | status | run_time |
2
- ---------------------------------- | ------ | --------------------- |
3
- ./spec/api_2captcha_spec.rb[1:1] | passed | 0.04326 seconds |
4
- ./spec/api_2captcha_spec.rb[1:2:1] | passed | 0.00121 seconds |
5
- ./spec/api_2captcha_spec.rb[1:3:1] | passed | 3.15 seconds |
6
- ./spec/api_2captcha_spec.rb[1:4:1] | passed | 2 minutes 0.2 seconds |
7
- ./spec/api_2captcha_spec.rb[1:5:1] | passed | 0.26142 seconds |
1
+ example_id | status | run_time |
2
+ ----------------------------------- | ------- | --------------------- |
3
+ ./spec/api_2captcha_spec.rb[1:1] | passed | 0.00056 seconds |
4
+ ./spec/api_2captcha_spec.rb[1:2:1] | passed | 0.00041 seconds |
5
+ ./spec/api_2captcha_spec.rb[1:3:1] | passed | 1.52 seconds |
6
+ ./spec/api_2captcha_spec.rb[1:4:1] | passed | 23.45 seconds |
7
+ ./spec/api_2captcha_spec.rb[1:5:1] | passed | 0.60409 seconds |
8
+ ./spec/api_2captcha_spec.rb[1:6:1] | passed | 12.42 seconds |
9
+ ./spec/api_2captcha_spec.rb[1:7:1] | passed | 1.37 seconds |
10
+ ./spec/api_2captcha_spec.rb[1:8:1] | passed | 1 minute 4.24 seconds |
11
+ ./spec/api_2captcha_spec.rb[1:9:1] | unknown | |
12
+ ./spec/api_2captcha_spec.rb[1:10:1] | unknown | |
13
+ ./spec/api_2captcha_spec.rb[1:11:1] | unknown | |
14
+ ./spec/api_2captcha_spec.rb[1:12:1] | unknown | |
15
+ ./spec/api_2captcha_spec.rb[1:13:1] | unknown | |
16
+ ./spec/api_2captcha_spec.rb[1:14:1] | passed | 0.29802 seconds |
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.0
1
+ 3.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-2captcha (1.1.5)
4
+ ruby-2captcha (1.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -44,6 +44,18 @@ Examples of API requests for different captcha types are available on the [Ruby
44
44
  - [Cutcaptcha](#cutcaptcha)
45
45
  - [Tencent](#tencent)
46
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)
47
59
  - [Other methods](#other-methods)
48
60
  - [send / get_result](#send--get_result)
49
61
  - [balance](#balance)
@@ -93,7 +105,7 @@ client.api_key = "YOUR_API_KEY"
93
105
 
94
106
  |Option |Default value|Description |
95
107
  |----------------|-------------|------------------------------------------------------------------------|
96
- |soft_id |4584 |your software ID obtained after publishing in [2captcha sofware catalog]|
108
+ |soft_id |4584 |your software ID obtained after publishing in [2captcha software catalog]|
97
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|
98
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|
99
111
  |polling_interval|10 |Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended|
@@ -110,7 +122,7 @@ When you submit any image-based captcha use can provide additional options to he
110
122
  | Option | Default Value | Description |
111
123
  | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
112
124
  | numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][normal_post] |
113
- | min_len | 0 | minimal answer lenght |
125
+ | min_len | 0 | minimal answer length |
114
126
  | max_len | 0 | maximum answer length |
115
127
  | phrase | 0 | defines if the answer contains multiple words or not |
116
128
  | case_sensitive| 0 | defines if the answer is case sensitive |
@@ -494,6 +506,188 @@ result = client.atb_captcha({
494
506
  })
495
507
  ```
496
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
+
497
691
  ## Other methods
498
692
 
499
693
  ### send / get_result
@@ -600,11 +794,11 @@ The graphics and trademarks included in this repository are not covered by the M
600
794
 
601
795
  <!-- Shared links -->
602
796
  [2Captcha]: https://2captcha.com/
603
- [2captcha sofware catalog]: https://2captcha.com/software
797
+ [2captcha software catalog]: https://2captcha.com/software
604
798
  [pingback settings]: https://2captcha.com/setting/pingback
605
799
  [normal_post]: https://2captcha.com/2captcha-api#normal_post
606
800
  [list of supported languages]: https://2captcha.com/2captcha-api#language
607
801
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
608
802
  [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
609
803
  [examples]: ./examples/
610
- [residential proxies]: https://2captcha.com/proxy/residential-proxies
804
+ [residential proxies]: https://2captcha.com/proxy/residential-proxies
data/README.ru.md CHANGED
@@ -41,6 +41,18 @@
41
41
  - [Cutcaptcha](#cutcaptcha)
42
42
  - [Tencent](#tencent)
43
43
  - [atbCAPTCHA](#atbcaptcha)
44
+ - [Prosopo](#prosopo)
45
+ - [Captchafox](#captchafox)
46
+ - [Temu](#temu)
47
+ - [VK Captcha](#vk-captcha)
48
+ - [Altcha Captcha](#altcha-captcha)
49
+ - [Binancecaptcha](#binancecaptcha)
50
+ - [Hunt Captcha](#hunt-captcha)
51
+ - [Tspd](#tspd)
52
+ - [Basilisk](#basilisk)
53
+ - [Alibaba](#alibaba)
54
+ - [Yidun](#yidun)
55
+ - [Drag & Drop Captcha](#drag--drop-captcha)
44
56
  - [Другие методы](#другие-методы)
45
57
  - [send / get_result](#send--get_result)
46
58
  - [Баланс](#баланс)
@@ -476,6 +488,197 @@ result = client.atb_captcha({
476
488
  })
477
489
  ```
478
490
 
491
+ ### Prosopo
492
+
493
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
494
+
495
+ Основанный на токенах метод автоматизированного решения капчи Prosopo.
496
+
497
+ ```ruby
498
+ result = client.prosopo({
499
+ pageurl: "https://www.twickets.live/",
500
+ sitekey: "5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"
501
+ })
502
+ ```
503
+
504
+ ### Captchafox
505
+
506
+ <sup>[Описание метода API.](https://2captcha.com/2captcha-api#captchafox)</sup>
507
+
508
+ Основанный на токенах метод автоматизированного решения капчи Captchafox.
509
+
510
+ ```ruby
511
+ result = client.captchafox({
512
+ sitekey: "sitekey",
513
+ pageurl: "https://pageurl/",
514
+ api_server: "https://mam.example.com",
515
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0 Safari/537.36",
516
+ proxytype: "socks5",
517
+ proxy: "proxyuser:strongPassword@123.123.123.123:3128"
518
+ })
519
+ ```
520
+
521
+ ### Temu
522
+
523
+ <sup>[API method description.](https://2captcha.com/2captcha-api#temucaptcha)</sup>
524
+
525
+ Основанный на токенах метод автоматизированного решения капчи Temu.
526
+
527
+ ```ruby
528
+ result = client.temu({
529
+ body: bodyStr,
530
+ part1: part1Str,
531
+ part2: part2Str,
532
+ part3: part3Str,
533
+ ### VK Image
534
+
535
+ <sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
536
+
537
+ Мы используем текст (изображение в формате base64) или файл (изображение как файл) и параметры steps.
538
+ Вы можете получить оба значения из ответа на запрос https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} при загрузке виджета captcha на страницу.
539
+
540
+ ```ruby
541
+ result = client.vkimage({
542
+ image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
543
+ steps: '[5,19,14,14,6,4,8...]'
544
+ })
545
+ ```
546
+
547
+ ### VK Captcha
548
+
549
+ <sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
550
+
551
+ Для метода, основанного на токенах, требуется параметр `redirect_uri`, а также прокси-сервер и UserAgent. Значение параметра `redirect_uri` можно найти в ответах на запросы к VK API, которые возвращают captcha.
552
+
553
+ ```ruby
554
+ result = client.vkcaptcha({
555
+ redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
556
+ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
557
+ })
558
+ ```
559
+
560
+ ### Altcha Captcha
561
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#altchacaptcha)</sup>
562
+
563
+ Используйте этот метод для решения капчи Altcha. В ответ возвращается токен.
564
+
565
+ ```ruby
566
+ result = client.altcha({
567
+ pageurl: 'https://mysite.com/page/with/altcha',
568
+ challenge: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...","signature":"7b3e2a9d5c8f1046e2d91c3a..."}'
569
+ # или:
570
+ # challenge_url: 'https://example.com/altcha-challenge'
571
+ })
572
+ ```
573
+
574
+ ### Binancecaptcha
575
+
576
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#binance)</sup>
577
+
578
+ Используйте этот метод для решения капчи Binancecaptcha. В ответ возвращается токен.
579
+
580
+ ```ruby
581
+ result = client.binance({
582
+ sitekey => "login",
583
+ url => "https://example.com/page-with-binance",
584
+ validate_id => "cb0bfef...e54ecd57b"
585
+ })
586
+ ```
587
+
588
+ ### Hunt Captcha
589
+
590
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#hunt)</sup>
591
+
592
+ Основанный на токенах метод автоматизированного решения Hunt captcha. Использует двухшаговый процесс: первый запрос без `data` возвращает X-HD fingerprint; после отправки его на сайт и получения `meta.token` второй запрос с `data` возвращает финальный токен.
593
+
594
+ > [!IMPORTANT]
595
+ > Для решения Hunt captcha необходимо использовать прокси. Рекомендуется использовать [резидентные прокси].
596
+
597
+ ```ruby
598
+ result = client.hunt({
599
+ pageurl: "https://example.com/page-with-hunt",
600
+ api_get_lib: "https://example.com/hd-api/external/apps/app-id/api.js",
601
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
602
+ proxytype: "http",
603
+ proxy: "proxyuser:strongPassword@123.123.123.123:3128"
604
+ })
605
+ ```
606
+
607
+ ### Tspd
608
+
609
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#tspd)</sup>
610
+
611
+ Используйте этот метод для решения капчи TSPD. В ответ возвращаются cookies. Прокси обязателен — режима без прокси не существует.
612
+
613
+ > [!IMPORTANT]
614
+ > Для решения TSPD captcha необходимо использовать прокси. Один и тот же IP-адрес должен использоваться на всех этапах: получение cookies, решение задачи и использование результата.
615
+
616
+ ```ruby
617
+ result = client.tspd({
618
+ pageurl: "https://example.com/page-with-tspd",
619
+ tspd_cookie: "TS...",
620
+ html_page_base64: "PGh0bWw+...",
621
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
622
+ proxytype: "http",
623
+ proxy: "proxyuser:strongPassword@123.123.123.123:3128"
624
+ })
625
+ ```
626
+
627
+ ### Basilisk
628
+
629
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#basilisk)</sup>
630
+
631
+ Основанный на токенах метод автоматизированного решения капчи Basilisk.
632
+
633
+ ```ruby
634
+ result = client.basilisk({
635
+ pageurl: "https://example.com/page-with-basilisk",
636
+ sitekey: "SITE_KEY"
637
+ })
638
+ ```
639
+
640
+ ### Alibaba
641
+
642
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#alibaba)</sup>
643
+
644
+ Основанный на токенах метод автоматизированного решения капчи Alibaba.
645
+
646
+ ```ruby
647
+ result = client.alibaba({
648
+ pageurl: "https://example.com/page-with-alibaba",
649
+ scene_id: "SCENE_ID",
650
+ prefix: "PREFIX"
651
+ })
652
+ ```
653
+
654
+ ### Yidun
655
+
656
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#yidun)</sup>
657
+
658
+ Основанный на токенах метод автоматизированного решения капчи Yidun.
659
+
660
+ ```ruby
661
+ result = client.yidun({
662
+ pageurl: "https://example.com/page-with-yidun",
663
+ sitekey: "SITE_KEY"
664
+ })
665
+ ```
666
+
667
+ ### Drag & Drop Captcha
668
+
669
+ <sup>[Описание метода API](https://2captcha.com/2captcha-api#drag-and-drop-captcha)</sup>
670
+
671
+ Используйте этот метод для решения капч, где одну или несколько картинок нужно перетащить на определённые позиции фонового изображения. `body` — фоновое изображение, `images` — массив изображений для перетаскивания, оба в Base64 — файлы нужно прочитать и закодировать самостоятельно, как показано ниже. Порядок `images` важен: в ответе используется тот же порядок.
672
+
673
+ В ответе приходит строка с координатами для каждой картинки из `images`, разделёнными `|`. Если картинку двигать не нужно, для неё возвращается буквальное значение `null`.
674
+
675
+ ```ruby
676
+ result = client.drag_drop({
677
+ body: bodyStr,
678
+ images: [image1Str, image2Str],
679
+ textinstructions: "Drag the images to proper position"
680
+ })
681
+ ```
479
682
 
480
683
  ## Другие методы
481
684
 
data/api_2captcha.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["info@2captcha.com"]
10
10
 
11
11
  spec.summary = "2Captcha API wrapper for Ruby."
12
- spec.description = "Ruby package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas."
12
+ spec.description = "Ruby package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, funcaptcha, geetest and solve any other captchas."
13
13
  spec.homepage = "https://2captcha.com/"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.6.0"
@@ -0,0 +1,16 @@
1
+
2
+ require_relative '../lib/api_2captcha'
3
+
4
+ client = Api2Captcha.new(ARGV[0])
5
+
6
+ begin
7
+ result = client.alibaba({
8
+ pageurl: "https://example.com/page-with-alibaba",
9
+ scene_id: "SCENE_ID",
10
+ prefix: "PREFIX"
11
+ })
12
+ rescue StandardError => e
13
+ puts(e)
14
+ end
15
+
16
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,12 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.altcha({
6
+ pageurl: 'https://mysite.com/page/with/altcha',
7
+ challenge: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...","signature":"7b3e2a9d5c8f1046e2d91c3a..."}'
8
+ # or:
9
+ # challenge_url: 'https://example.com/altcha-challenge'
10
+ })
11
+
12
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,14 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.amazon_waf({
6
+ sitekey: '0x1AAAAAAAAkg0s2VIOD34y5',
7
+ iv: 'CgAHbCe2GgAAAAAj',
8
+ context: '9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc=',
9
+ pageurl: 'https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest',
10
+ challenge_script: "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js",
11
+ captcha_script: "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js"
12
+ })
13
+
14
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,15 @@
1
+
2
+ require_relative '../lib/api_2captcha'
3
+
4
+ client = Api2Captcha.new(ARGV[0])
5
+
6
+ begin
7
+ result = client.basilisk({
8
+ pageurl: "https://example.com/page-with-basilisk",
9
+ sitekey: "SITE_KEY"
10
+ })
11
+ rescue StandardError => e
12
+ puts(e)
13
+ end
14
+
15
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,17 @@
1
+
2
+ require_relative '../lib/api_2captcha'
3
+
4
+ client = Api2Captcha.new(ARGV[0])
5
+
6
+ begin
7
+ result = client.binance({
8
+ sitekey => "login",
9
+ url => "https://example.com/page-with-binance",
10
+ validate_id => "cb0bfef...e54ecd57b"
11
+ })
12
+ rescue StandardError => e
13
+ puts(e)
14
+ end
15
+
16
+
17
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,13 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.canvas({
6
+ image: 'path/to/captcha.jpg',
7
+ previous_id: 0,
8
+ lang: 'en',
9
+ hint_image: 'path/to/hint.jpg',
10
+ hint_text: 'Draw around apple'
11
+ })
12
+
13
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,20 @@
1
+
2
+ require_relative '../lib/api_2captcha'
3
+
4
+ client = Api2Captcha.new(ARGV[0])
5
+
6
+ begin
7
+ result = client.captchafox({
8
+ sitekey: "sk_vKdD8WGlPF5FKpRDs1U4qTuu6Jv0w",
9
+ pageurl: "https://sinscrire.gmx.fr/",
10
+ api_server: "https://mam.example.com",
11
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
12
+ proxytype: "socks5",
13
+ proxy: "u37d88e6957ca05d6-zone-custom-region-fr:u37d88e6957ca05d6@118.193.59.17:10743"
14
+ })
15
+
16
+ rescue StandardError => e
17
+ puts(e)
18
+ end
19
+
20
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,11 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.capy({
6
+ sitekey: 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
7
+ pageurl: 'http://mysite.com/',
8
+ api_server: 'https://jp.api.capy.me/'
9
+ })
10
+
11
+ puts "Result: #{result.inspect}"
@@ -0,0 +1,15 @@
1
+ require 'api_2captcha'
2
+
3
+ client = Api2Captcha.new("YOUR_API_KEY")
4
+
5
+ result = client.turnstile({
6
+ sitekey: "0x0AAAAAAADnPIDROzbs0Aaj",
7
+ data: "7fab0000b0e0ff00",
8
+ pagedata: "3gAFo2...0ME1UVT0=",
9
+ pageurl: "https://2captcha.com/",
10
+ action: "managed",
11
+ userAgent: "Mozilla/5.0 ... Chrome/116.0.0.0 Safari/537.36",
12
+ json: 1
13
+ })
14
+
15
+ puts "Result: #{result.inspect}"