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
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ A Ruby client for the 2Captcha API.
- [CyberSiARA](#cybersiara)
- [DataDome](#datadome)
- [MTCaptcha](#mtcaptcha)
- [Friendly captcha](#friendly-captcha)
- [Other methods](#other-methods)
- [send / get_result](#send-get_result)
- [send / get_result](#send--get_result)
- [balance](#balance)
- [report](#report)
- [Error handling](#error-handling)
Expand Down Expand Up @@ -359,9 +360,19 @@ result = client.mt_captcha({
})
```

### Friendly captcha
Use this method to solve Friendly captcha and obtain a token to bypass the protection.
```ruby
result = client.friendly_captcha({
pageurl: "https://example.com",
sitekey: "2FZFEVS1FZCGQ9"
})
```

## Other methods

<h3 id="send-get_result"> send / get_result</h3>
### send / get_result

These methods can be used for manual captcha submission and answer polling.
```ruby

Expand Down
14 changes: 12 additions & 2 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Ruby-клиент для API 2Captcha.
- [CyberSiARA](#cybersiara)
- [DataDome](#datadome)
- [MTCaptcha](#mtcaptcha)
- [Friendly captcha](#friendly-captcha)
- [Другие методы](#other-methods)
- [send / get_result](#send-get_result)
- [send / get_result](#send--get_result)
- [balance](#balance)
- [report](#report)
- [Обработка ошибок](#error-handling)
Expand Down Expand Up @@ -316,9 +317,18 @@ result = client.mt_captcha({
})
```

### Friendly captcha
Метод решения Friendly captcha. Он возвращает токен для обхода капчи.
```ruby
result = client.friendly_captcha({
pageurl: "https://example.com",
sitekey: "2FZFEVS1FZCGQ9"
})
```

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

<h3 id="send-get_result"> send / get_result</h3>
### send / get_result
Эти методы могут быть использованы для ручного отправления капчи и получения результата.
```ruby
# пример для обычной капчи
Expand Down
12 changes: 8 additions & 4 deletions lib/api_2captcha/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ class Client
DEFAULT_DOMAIN = "2captcha.com"
BASE_URL_FORMAT = "https://%s"

attr_reader :api_key, :soft_id

attr_accessor :domain, :callback,
:default_timeout,
:recaptcha_timeout,
:polling_interval
:polling_interval,
:api_key, :soft_id

def initialize(api_key, soft_id = 0, callback = nil)
def initialize(api_key, callback = nil)
@api_key = api_key
@soft_id = soft_id
@callback = callback
@default_timeout = 120
@recaptcha_timeout = 600
@polling_interval = 10
@soft_id = 0
@domain = DEFAULT_DOMAIN
end

Expand Down Expand Up @@ -197,6 +197,10 @@ def mt_captcha(params)
solve("mt_captcha", **params)
end

def friendly(params)
solve("friendly_captcha", **params)
end

private

def base_url
Expand Down