Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Examples of API requests for different captcha types are available on the [Ruby
- [Cutcaptcha](#cutcaptcha)
- [Tencent](#tencent)
- [atbCAPTCHA](#atbcaptcha)
- [VK Image](#vk-image)
- [VK Captcha](#vk-captcha)
- [Other methods](#other-methods)
- [send / get_result](#send--get_result)
- [balance](#balance)
Expand Down Expand Up @@ -494,6 +496,33 @@ result = client.atb_captcha({
})
```

### VK Image

<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>

We use the body (image in base64 format) or file (image as file) and steps parameters.
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.

```ruby
result = client.vkimage({
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
steps: '[5,19,14,14,6,4,8...]'
})
```

### VK Captcha

<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>

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.

```ruby
result = client.vkcaptcha({
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
})
```

## Other methods

### send / get_result
Expand Down
27 changes: 27 additions & 0 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- [Cutcaptcha](#cutcaptcha)
- [Tencent](#tencent)
- [atbCAPTCHA](#atbcaptcha)
- [VK Captcha](#vk-captcha)
- [Другие методы](#другие-методы)
- [send / get_result](#send--get_result)
- [Баланс](#баланс)
Expand Down Expand Up @@ -476,6 +477,32 @@ result = client.atb_captcha({
})
```

### VK Image

<sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>

Мы используем текст (изображение в формате base64) или файл (изображение как файл) и параметры steps.
Вы можете получить оба значения из ответа на запрос https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} при загрузке виджета captcha на страницу.

```ruby
result = client.vkimage({
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
steps: '[5,19,14,14,6,4,8...]'
})
```

### VK Captcha

<sup>[API описание метода.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>

Для метода, основанного на токенах, требуется параметр `redirect_uri`, а также прокси-сервер и UserAgent. Значение параметра `redirect_uri` можно найти в ответах на запросы к VK API, которые возвращают captcha.

```ruby
result = client.vkcaptcha({
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
})
```

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

Expand Down
6 changes: 4 additions & 2 deletions examples/normal_captcha_example.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
require 'api_2captcha'

client = Api2Captcha.new("YOUR_API_KEY")
client = Api2Captcha.new(ARGV[0])

image_absolute_path = File.expand_path("../media/normal_2.jpg", __FILE__)

result = client.normal({
image: './media/normal_2.jpg',
image: image_absolute_path,
})

puts "Result: #{result.inspect}"
10 changes: 10 additions & 0 deletions examples/vkcaptcha_example.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'api_2captcha'

client = Api2Captcha.new("YOUR_API_KEY")

result = client.vkcaptcha({
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
})

puts "Result: #{result.inspect}"
10 changes: 10 additions & 0 deletions examples/vkimage_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'api_2captcha'

client = Api2Captcha.new("YOUR_API_KEY")

result = client.vkimage({
image: '/9j/4AAQSkZJRgABAQAAAQABAAD/2...',
steps: '[5,19,14,14,6,4,8...]'
})

puts "Result: #{result.inspect}"
8 changes: 8 additions & 0 deletions lib/api_2captcha/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ def amazon_waf(params)
solve("amazon_waf", **params)
end

def vkimage(params)
solve("vkimage", **params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Было бы неплохо добавить пример для этого метода.

end

def vkcaptcha(params)
solve("vkcaptcha", **params)
end

def audio(params)
audio = params.delete(:audio)
audio_content = File.file?(audio) ? File.binread(audio) : audio
Expand Down