anti_captcha 2.4.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -42
- data/lib/anti_captcha/client.rb +41 -39
- data/lib/anti_captcha/models/turnstile_solution.rb +13 -0
- data/lib/anti_captcha/version.rb +1 -1
- data/lib/anti_captcha.rb +1 -0
- metadata +7 -7
- data/lib/anti_captcha/models/h_captcha_solution.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db85d1586244634fe6f124e9574e93678a2a59138c1ee78c780b61aa699619e
|
4
|
+
data.tar.gz: bdf1e212aa6efdfa2243589d07114050b5796d39c5ecdf16ab7a2cc485ef2124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1165c9a41a66603e82a698100564c8ed419111d54b73ae909f3ab56a3720046c8487c614147d7570f57211dc0fc979b117fb08407d9333f85add93ebde2da91
|
7
|
+
data.tar.gz: cfa3add2a4cbd04040a74f491eb173fce9da94f47111c9a1a301c176872f18b216cfbef03ab0158c0caae29d67695b89bd8b0511681c58203103066960213634
|
data/README.md
CHANGED
@@ -2,9 +2,6 @@
|
|
2
2
|
|
3
3
|
AntiCaptcha is a Ruby API for Anti-Captcha - [Anti-Captcha.com](http://getcaptchasolution.com/ipuz16klxh)
|
4
4
|
|
5
|
-
> We suggest you to also check the recommended CAPTCHA provider DeathByCaptcha.
|
6
|
-
> The gem for this provider is available at https://github.com/infosimples/deathbycaptcha.
|
7
|
-
|
8
5
|
## Installation
|
9
6
|
|
10
7
|
Add this line to your application's Gemfile:
|
@@ -94,8 +91,8 @@ solution.g_recaptcha_response
|
|
94
91
|
solution = client.decode_recaptcha_v3!(
|
95
92
|
website_key: 'xyz',
|
96
93
|
website_url: 'http://example.com/example=1',
|
97
|
-
min_score: 0.3,
|
98
94
|
page_action: 'myverify',
|
95
|
+
min_score: 0.3, # OPTIONAL
|
99
96
|
# is_enterprise: false, # OPTIONAL
|
100
97
|
)
|
101
98
|
|
@@ -122,40 +119,6 @@ solution.g_recaptcha_response
|
|
122
119
|
> About the `min_score` parameter: it's strongly recommended to use a minimum score of `0.3` as higher
|
123
120
|
> scores are rare.
|
124
121
|
|
125
|
-
#### hCaptcha
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
solution = client.decode_h_captcha!(
|
129
|
-
website_key: 'xyz',
|
130
|
-
website_url: 'http://example.com/example=1',
|
131
|
-
# proxy_type: 'http', # OPTIONAL
|
132
|
-
# proxy_address: '127.0.0.1', # OPTIONAL
|
133
|
-
# proxy_port: '8080', # OPTIONAL
|
134
|
-
# proxy_login: 'proxyLoginHere', # OPTIONAL
|
135
|
-
# proxy_password: 'proxyPasswordHere', # OPTIONAL
|
136
|
-
# user_agent: 'MODERN_USER_AGENT_HERE', # OPTIONAL
|
137
|
-
)
|
138
|
-
|
139
|
-
solution.token
|
140
|
-
"P0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNza2V5IjoiNnpWV..."
|
141
|
-
|
142
|
-
# Or
|
143
|
-
|
144
|
-
solution.g_recaptcha_response # Deprecated
|
145
|
-
"P0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNza2V5IjoiNnpWV..."
|
146
|
-
```
|
147
|
-
|
148
|
-
*Parameters:*
|
149
|
-
|
150
|
-
- `website_key`: the site key for the hCatpcha.
|
151
|
-
- `website_url`: the URL of the page with the hCaptcha challenge.
|
152
|
-
- `proxy_type`: optional parameter. Proxy connection protocol.
|
153
|
-
- `proxy_address`: optional parameter. The proxy address.
|
154
|
-
- `proxy_port`: optional parameter. The proxy port.
|
155
|
-
- `proxy_login`: optional parameter. The proxy login.
|
156
|
-
- `proxy_password`: optional parameter. The proxy password.
|
157
|
-
- `user_agent`: optional parameter. The user agent.
|
158
|
-
|
159
122
|
#### FunCaptcha
|
160
123
|
|
161
124
|
```ruby
|
@@ -177,7 +140,7 @@ solution.token
|
|
177
140
|
*Parameters:*
|
178
141
|
|
179
142
|
- `website_key`: the site key for the hCatpcha.
|
180
|
-
- `website_url`: the URL of the page with the
|
143
|
+
- `website_url`: the URL of the page with the challenge.
|
181
144
|
- `proxy_type`: optional parameter. Proxy connection protocol.
|
182
145
|
- `proxy_address`: optional parameter. The proxy address.
|
183
146
|
- `proxy_port`: optional parameter. The proxy port.
|
@@ -242,6 +205,37 @@ solution.v4['captcha_output']
|
|
242
205
|
- `proxy_password`: optional parameter. The proxy password.
|
243
206
|
- `user_agent`: optional parameter. The user agent.
|
244
207
|
|
208
|
+
#### Cloudflare Turnstile
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
solution = client.decode_turnstile!(
|
212
|
+
website_key: 'xyz',
|
213
|
+
website_url: 'http://example.com/example=1',
|
214
|
+
# action: 'contact_form', # OPTIONAL
|
215
|
+
# cdata: 'xyz', # OPTIONAL
|
216
|
+
# proxy_type: 'http', # OPTIONAL
|
217
|
+
# proxy_address: '127.0.0.1', # OPTIONAL
|
218
|
+
# proxy_port: '8080', # OPTIONAL
|
219
|
+
# proxy_login: 'proxyLoginHere', # OPTIONAL
|
220
|
+
# proxy_password: 'proxyPasswordHere', # OPTIONAL
|
221
|
+
)
|
222
|
+
|
223
|
+
solution.token
|
224
|
+
"0.vtJqmZnvobaUzK2i2PyKaSqHELYtBZfRoPwMvLMdA81WL_9G0vCO3y2VQVIeVplG0mxYF7uX......."
|
225
|
+
```
|
226
|
+
|
227
|
+
*Parameters:*
|
228
|
+
|
229
|
+
- `website_key`: the site key for the Turnstile.
|
230
|
+
- `website_url`: the URL of the page with the Turnstile challenge.
|
231
|
+
- `action`: optional parameter. Turnstile challenge unique action.
|
232
|
+
- `cdata`: optional parameter. Turnstile challenge cData token.
|
233
|
+
- `proxy_type`: optional parameter. Proxy connection protocol.
|
234
|
+
- `proxy_address`: optional parameter. The proxy address.
|
235
|
+
- `proxy_port`: optional parameter. The proxy port.
|
236
|
+
- `proxy_login`: optional parameter. The proxy login.
|
237
|
+
- `proxy_password`: optional parameter. The proxy password.
|
238
|
+
|
245
239
|
### 3. Report an incorrectly solved image CAPTCHA for a refund
|
246
240
|
|
247
241
|
It is only possible to report incorrectly solved image CAPTCHAs.
|
@@ -271,11 +265,11 @@ Queue IDs:
|
|
271
265
|
- `18` Recaptcha V3 s0.3
|
272
266
|
- `19` Recaptcha V3 s0.7
|
273
267
|
- `20` Recaptcha V3 s0.9
|
274
|
-
- `21` hCaptcha with proxy
|
275
|
-
- `22` hCaptcha without proxy
|
276
268
|
- `23` Recaptcha Enterprise V2 with proxy
|
277
269
|
- `24` Recaptcha Enterprise V2 without proxy
|
278
270
|
- `25` AntiGateTask
|
271
|
+
- `26` Turnstile with proxy
|
272
|
+
- `27` Turnstile without proxy
|
279
273
|
|
280
274
|
```ruby
|
281
275
|
client.get_queue_stats!(queue_id)
|
@@ -290,7 +284,7 @@ avoid conflicts with other gems.
|
|
290
284
|
|
291
285
|
### Input image format
|
292
286
|
|
293
|
-
Any format you use in the `decode_image!` method (`file`, `path`, `body
|
287
|
+
Any format you use in the `decode_image!` method (`file`, `path`, `body` or `body64`)
|
294
288
|
will always be converted to a `body64`, which is a base64-encoded binary string.
|
295
289
|
So, if you already have this format on your end, there is no need for convertions
|
296
290
|
before calling the API.
|
data/lib/anti_captcha/client.rb
CHANGED
@@ -4,7 +4,7 @@ module AntiCaptcha
|
|
4
4
|
#
|
5
5
|
class Client
|
6
6
|
BASE_URL = 'https://api.anti-captcha.com/:action'
|
7
|
-
PROXYABLE_TASKS = %w(RecaptchaV2Task FunCaptchaTask
|
7
|
+
PROXYABLE_TASKS = %w(RecaptchaV2Task FunCaptchaTask GeeTestTask TurnstileTask)
|
8
8
|
|
9
9
|
attr_accessor :client_key, :timeout, :polling
|
10
10
|
|
@@ -170,22 +170,27 @@ module AntiCaptcha
|
|
170
170
|
end
|
171
171
|
|
172
172
|
#
|
173
|
-
# Decodes a
|
173
|
+
# Decodes a Geetest CAPTCHA.
|
174
174
|
#
|
175
|
-
# @see `AntiCaptcha::Client#
|
175
|
+
# @see `AntiCaptcha::Client#decode_geetest!`
|
176
176
|
#
|
177
|
-
def
|
178
|
-
|
177
|
+
def decode_geetest(options, proxy = nil)
|
178
|
+
decode_geetest!(options, proxy)
|
179
179
|
rescue
|
180
|
-
AntiCaptcha::
|
180
|
+
AntiCaptcha::GeetestSolution.new
|
181
181
|
end
|
182
182
|
|
183
183
|
#
|
184
|
-
# Decodes a
|
184
|
+
# Decodes a Geetest CAPTCHA.
|
185
185
|
#
|
186
186
|
# @param [Hash] options Options hash.
|
187
187
|
# @option options [String] :website_url
|
188
|
-
# @option options [String] :
|
188
|
+
# @option options [String] :gt
|
189
|
+
# @option options [String] :challenge
|
190
|
+
# @option options [String] :geetest_api_server_subdomain
|
191
|
+
# @option options [String] :geetest_get_lib
|
192
|
+
# @option options [String] :version
|
193
|
+
# @option options [String] :init_parameters
|
189
194
|
#
|
190
195
|
# @param [Hash] proxy Not mandatory. A hash with configs of the proxy that
|
191
196
|
# has to be used. Defaults to `nil`.
|
@@ -197,36 +202,33 @@ module AntiCaptcha
|
|
197
202
|
# @option proxy [String] :proxy_password
|
198
203
|
# @option proxy [String] :user_agent
|
199
204
|
#
|
200
|
-
# @return [AntiCaptcha::
|
205
|
+
# @return [AntiCaptcha::GeetestSolution] The solution of the Geetest.
|
201
206
|
#
|
202
|
-
def
|
203
|
-
task = create_task!('
|
207
|
+
def decode_geetest!(options, proxy = nil)
|
208
|
+
task = create_task!('GeeTestTask', options, proxy)
|
204
209
|
task_result = get_task_result!(task['taskId'])
|
205
|
-
AntiCaptcha::
|
210
|
+
AntiCaptcha::GeetestSolution.new(task_result)
|
206
211
|
end
|
207
212
|
|
208
213
|
#
|
209
|
-
# Decodes a
|
214
|
+
# Decodes a Turnstile CAPTCHA.
|
210
215
|
#
|
211
|
-
# @see `AntiCaptcha::Client#
|
216
|
+
# @see `AntiCaptcha::Client#decode_turnstile!`
|
212
217
|
#
|
213
|
-
def
|
214
|
-
|
218
|
+
def decode_turnstile(options, proxy = nil)
|
219
|
+
decode_turnstile!(options, proxy)
|
215
220
|
rescue
|
216
|
-
AntiCaptcha::
|
221
|
+
AntiCaptcha::TurnstileSolution.new
|
217
222
|
end
|
218
223
|
|
219
224
|
#
|
220
|
-
# Decodes a
|
225
|
+
# Decodes a Turnstile CAPTCHA.
|
221
226
|
#
|
222
227
|
# @param [Hash] options Options hash.
|
223
228
|
# @option options [String] :website_url
|
224
|
-
# @option options [String] :
|
225
|
-
# @option options [String] :
|
226
|
-
# @option options [String] :
|
227
|
-
# @option options [String] :geetest_get_lib
|
228
|
-
# @option options [String] :version
|
229
|
-
# @option options [String] :init_parameters
|
229
|
+
# @option options [String] :website_key
|
230
|
+
# @option options [String] :action
|
231
|
+
# @option options [String] :cdata
|
230
232
|
#
|
231
233
|
# @param [Hash] proxy Not mandatory. A hash with configs of the proxy that
|
232
234
|
# has to be used. Defaults to `nil`.
|
@@ -234,16 +236,14 @@ module AntiCaptcha
|
|
234
236
|
# @option proxy [String] :proxy_address
|
235
237
|
# @option proxy [String] :proxy_port
|
236
238
|
# @option proxy [String] :proxy_login
|
237
|
-
# @option proxy [String] :proxy_login
|
238
239
|
# @option proxy [String] :proxy_password
|
239
|
-
# @option proxy [String] :user_agent
|
240
240
|
#
|
241
|
-
# @return [AntiCaptcha::
|
241
|
+
# @return [AntiCaptcha::TurnstileSolution] The solution of the Turnstile.
|
242
242
|
#
|
243
|
-
def
|
244
|
-
task = create_task!('
|
243
|
+
def decode_turnstile!(options, proxy = nil)
|
244
|
+
task = create_task!('TurnstileTask', options, proxy)
|
245
245
|
task_result = get_task_result!(task['taskId'])
|
246
|
-
AntiCaptcha::
|
246
|
+
AntiCaptcha::TurnstileSolution.new(task_result)
|
247
247
|
end
|
248
248
|
|
249
249
|
# Creates a task for solving the selected CAPTCHA type.
|
@@ -330,13 +330,6 @@ module AntiCaptcha
|
|
330
330
|
websitePublicKey: options[:website_public_key],
|
331
331
|
}
|
332
332
|
|
333
|
-
when 'HCaptchaTask'
|
334
|
-
args[:task] = {
|
335
|
-
type: 'HCaptchaTask',
|
336
|
-
websiteURL: options[:website_url],
|
337
|
-
websiteKey: options[:website_key],
|
338
|
-
}
|
339
|
-
|
340
333
|
when 'GeeTestTask'
|
341
334
|
args[:task] = {
|
342
335
|
type: 'GeeTestTask',
|
@@ -349,6 +342,15 @@ module AntiCaptcha
|
|
349
342
|
args[:version] = options[:version] if !options[:version].nil?
|
350
343
|
args[:initParameters] = options[:init_parameters] if !options[:init_parameters].nil?
|
351
344
|
|
345
|
+
when 'TurnstileTask'
|
346
|
+
args[:task] = {
|
347
|
+
type: 'TurnstileTask',
|
348
|
+
websiteURL: options[:website_url],
|
349
|
+
websiteKey: options[:website_key],
|
350
|
+
action: options[:action],
|
351
|
+
turnstileCData: options[:cdata],
|
352
|
+
}
|
353
|
+
|
352
354
|
else
|
353
355
|
message = "Invalid task type: '#{type}'."
|
354
356
|
raise AntiCaptcha::ArgumentError.new(message)
|
@@ -419,8 +421,8 @@ module AntiCaptcha
|
|
419
421
|
# 18 - Recaptcha V3 s0.3
|
420
422
|
# 19 - Recaptcha V3 s0.7
|
421
423
|
# 20 - Recaptcha V3 s0.9
|
422
|
-
#
|
423
|
-
#
|
424
|
+
# 26 - Turnstile Proxy-On
|
425
|
+
# 27 - Turnstile Proxyless
|
424
426
|
#
|
425
427
|
# @return [Hash] Information about the queue.
|
426
428
|
#
|
data/lib/anti_captcha/version.rb
CHANGED
data/lib/anti_captcha.rb
CHANGED
@@ -38,6 +38,7 @@ require 'anti_captcha/models/recaptcha_v3_solution'
|
|
38
38
|
require 'anti_captcha/models/fun_captcha_solution'
|
39
39
|
require 'anti_captcha/models/h_captcha_solution'
|
40
40
|
require 'anti_captcha/models/geetest_solution'
|
41
|
+
require 'anti_captcha/models/turnstile_solution'
|
41
42
|
require 'anti_captcha/models/task_result'
|
42
43
|
require 'anti_captcha/client'
|
43
44
|
require 'anti_captcha/version'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anti_captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infosimples
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,18 +76,18 @@ files:
|
|
76
76
|
- lib/anti_captcha/http.rb
|
77
77
|
- lib/anti_captcha/models/fun_captcha_solution.rb
|
78
78
|
- lib/anti_captcha/models/geetest_solution.rb
|
79
|
-
- lib/anti_captcha/models/h_captcha_solution.rb
|
80
79
|
- lib/anti_captcha/models/image_to_text_solution.rb
|
81
80
|
- lib/anti_captcha/models/recaptcha_v2_solution.rb
|
82
81
|
- lib/anti_captcha/models/recaptcha_v3_solution.rb
|
83
82
|
- lib/anti_captcha/models/solution.rb
|
84
83
|
- lib/anti_captcha/models/task_result.rb
|
84
|
+
- lib/anti_captcha/models/turnstile_solution.rb
|
85
85
|
- lib/anti_captcha/version.rb
|
86
86
|
homepage: https://github.com/infosimples/anti_captcha
|
87
87
|
licenses:
|
88
88
|
- MIT
|
89
89
|
metadata: {}
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
-
signing_key:
|
105
|
+
rubygems_version: 3.5.23
|
106
|
+
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Ruby API for Anti Captcha (CAPTCHA Solver as a Service)
|
109
109
|
test_files: []
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module AntiCaptcha
|
2
|
-
class HCaptchaSolution < AntiCaptcha::Solution
|
3
|
-
attr_accessor :g_recaptcha_response # Deprecated
|
4
|
-
attr_accessor :token
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(task_result = nil)
|
8
|
-
super
|
9
|
-
|
10
|
-
if task_result
|
11
|
-
@token = task_result.api_result['solution']['gRecaptchaResponse']
|
12
|
-
@g_recaptcha_response = token
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|