Skip to content

Commit 26b33ba

Browse files
authored
Merge pull request #26 from 2captcha/vk-method-support
added vkimage, vkcaptcha
2 parents 17be997 + a5cd50c commit 26b33ba

File tree

6 files changed

+88
-2
lines changed

6 files changed

+88
-2
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Examples of API requests for different captcha types are available on the [Ruby
4444
- [Cutcaptcha](#cutcaptcha)
4545
- [Tencent](#tencent)
4646
- [atbCAPTCHA](#atbcaptcha)
47+
- [VK Image](#vk-image)
48+
- [VK Captcha](#vk-captcha)
4749
- [Other methods](#other-methods)
4850
- [send / get_result](#send--get_result)
4951
- [balance](#balance)
@@ -494,6 +496,33 @@ result = client.atb_captcha({
494496
})
495497
```
496498

499+
### VK Image
500+
501+
<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>
502+
503+
We use the body (image in base64 format) or file (image as file) and steps parameters.
504+
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.
505+
506+
```ruby
507+
result = client.vkimage({
508+
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
509+
steps: '[5,19,14,14,6,4,8...]'
510+
})
511+
```
512+
513+
### VK Captcha
514+
515+
<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>
516+
517+
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.
518+
519+
```ruby
520+
result = client.vkcaptcha({
521+
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
522+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
523+
})
524+
```
525+
497526
## Other methods
498527

499528
### send / get_result

README.ru.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- [Cutcaptcha](#cutcaptcha)
4242
- [Tencent](#tencent)
4343
- [atbCAPTCHA](#atbcaptcha)
44+
- [VK Captcha](#vk-captcha)
4445
- [Другие методы](#другие-методы)
4546
- [send / get_result](#send--get_result)
4647
- [Баланс](#баланс)
@@ -476,6 +477,32 @@ result = client.atb_captcha({
476477
})
477478
```
478479

480+
### VK Image
481+
482+
<sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
483+
484+
Мы используем текст (изображение в формате base64) или файл (изображение как файл) и параметры steps.
485+
Вы можете получить оба значения из ответа на запрос https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} при загрузке виджета captcha на страницу.
486+
487+
```ruby
488+
result = client.vkimage({
489+
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
490+
steps: '[5,19,14,14,6,4,8...]'
491+
})
492+
```
493+
494+
### VK Captcha
495+
496+
<sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
497+
498+
Для метода, основанного на токенах, требуется параметр `redirect_uri`, а также прокси-сервер и UserAgent. Значение параметра `redirect_uri` можно найти в ответах на запросы к VK API, которые возвращают captcha.
499+
500+
```ruby
501+
result = client.vkcaptcha({
502+
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
503+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
504+
})
505+
```
479506

480507
## Другие методы
481508

examples/normal_captcha_example.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
require 'api_2captcha'
22

3-
client = Api2Captcha.new("YOUR_API_KEY")
3+
client = Api2Captcha.new(ARGV[0])
4+
5+
image_absolute_path = File.expand_path("../media/normal_2.jpg", __FILE__)
46

57
result = client.normal({
6-
image: './media/normal_2.jpg',
8+
image: image_absolute_path,
79
})
810

911
puts "Result: #{result.inspect}"

examples/vkcaptcha_example.ru

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'api_2captcha'
2+
3+
client = Api2Captcha.new("YOUR_API_KEY")
4+
5+
result = client.vkcaptcha({
6+
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
7+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
8+
})
9+
10+
puts "Result: #{result.inspect}"

examples/vkimage_example.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'api_2captcha'
2+
3+
client = Api2Captcha.new("YOUR_API_KEY")
4+
5+
result = client.vkimage({
6+
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
7+
steps: '[5,19,14,14,6,4,8...]'
8+
})
9+
10+
puts "Result: #{result.inspect}"

lib/api_2captcha/client.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ def amazon_waf(params)
170170
solve("amazon_waf", **params)
171171
end
172172

173+
def vkimage(params)
174+
solve("vkimage", **params)
175+
end
176+
177+
def vkcaptcha(params)
178+
solve("vkcaptcha", **params)
179+
end
180+
173181
def audio(params)
174182
audio = params.delete(:audio)
175183
audio_content = File.file?(audio) ? File.binread(audio) : audio

0 commit comments

Comments
 (0)