anti_captcha 2.1.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c824ede49ec41b2b6ff994fbb8b3caae33f935e78daa10759537d44b59c37a5f
4
- data.tar.gz: b043e76306535964664fdab5e80a51ee63743be47c2900d810769c9332ec77df
3
+ metadata.gz: 3f88c8306b71ac67c12e419775def29a07ca2ff868a6114b3ae63e342355ee0a
4
+ data.tar.gz: 3942d3860188b958da95dc7d0a1392b1e725007b3254849ac3ff0667d19cdb8f
5
5
  SHA512:
6
- metadata.gz: c0894512b1baaf7bf6b53bcdee0c34c25fdad188c3ce499194aefb68beae30ec360ad47e059fb54dffdb2da3fe9629706021155f78bf7319f83c4dcb0e6b01e6
7
- data.tar.gz: b51249b061d7a8a85c0909cece6b6f7f07cc7c4c25bc8ae2826197ca24e28f89b93302d2497663b78ebdfb2e5ff1c47f1e19bcbd2649c51b359118c4080f085f
6
+ metadata.gz: f26aa3040dde769a91dbc17a5e81a068a34adcf38d32a352989694928675f8c55af1343ee7ab41d59a755ed08a4470709b368de8d7f8d9ee53bcb3ec71a9f405
7
+ data.tar.gz: 9f02777af3ab19e95f158abff4007ad6870f513a3338ba569daf904a9bb6ab955b58b82cadc07c8070dc46f3d7b72639a57629f012b6f02b4d093d7223d3df18
data/README.md CHANGED
@@ -135,6 +135,41 @@ Or install it yourself as:
135
135
  solution.token # Solution of the captcha
136
136
  ```
137
137
 
138
+ 8. **reCAPTCHA V3**
139
+
140
+ This method allows you to solve [reCAPTCHA v3](https://developers.google.com/recaptcha/docs/v3).
141
+
142
+ There are two methods available:
143
+
144
+ - `decode_recaptcha_v3`: solves reCAPTCHA v3. It doesn't raise exceptions.
145
+ - `decode_recaptcha_v3!`: solves reCAPTCHA v3. It may raise an `AntiCaptcha::Error` if something goes wrong.
146
+
147
+ **Send the `website_key`, `website_url`, `min_score` and `page_action` parameters**
148
+
149
+ This method requires no browser emulation. You can send four parameters that
150
+ identify the website in which the CAPTCHA is found and the minimum score (0.3, 0.5 or 0.7) you
151
+ desire.
152
+
153
+ ```ruby
154
+ options = {
155
+ website_key: 'xyz',
156
+ website_url: 'http://example.com/example=1',
157
+ min_score: 0.3,
158
+ page_action: 'myverify'
159
+ }
160
+
161
+ solution = client.decode_recaptcha_v3!(options)
162
+ solution.g_recaptcha_response # Solution of the captcha
163
+ ```
164
+
165
+ The solution (`solution.g_recaptcha_response`) will be a code that validates
166
+ the form, like the following:
167
+
168
+ ```ruby
169
+ "1JJHJ_VuuHAqJKxcaasbTsqw-L1Sm4gD57PTeaEr9-MaETG1vfu2H5zlcwkjsRoZoHxx6V9yUDw8Ig-hYD8kakmSnnjNQd50w_Y_tI3aDLp-s_7ZmhH6pcaoWWsid5hdtMXyvrP9DscDuCLBf7etLle8caPWSaYCpAq9DOTtj5NpSg6-OeCJdGdkjsakFUMeGeqmje87wSajcjmdjl_w4XZBY2zy8fUH6XoAGZ6AeCTulIljBQDObQynKDd-rutPvKNxZasDk-LbhTfw508g1lu9io6jnvm3kbAdnkfZ0x0PkGiUMHU7hnuoW6bXo2Yn_Zt5tDWL7N7wFtY6B0k7cTy73f8er508zReOuoyz2NqL8smDCmcJu05ajkPGt20qzpURMwHaw"
170
+ ```
171
+
172
+
138
173
  ## Notes
139
174
 
140
175
  #### Ruby dependencies
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["team@infosimples.com.br"]
11
11
 
12
12
  spec.summary = %q{Ruby API for Anti Captcha (CAPTCHA Solver as a Service)}
13
- spec.description = %q{TwoCaptcha is an automated CAPTCHA solving service}
13
+ spec.description = %q{Anti Captcha is an automated CAPTCHA solving service}
14
14
  spec.homepage = "https://github.com/infosimples/anti_captcha"
15
15
  spec.license = "MIT"
16
16
 
@@ -34,6 +34,7 @@ require 'anti_captcha/errors'
34
34
  require 'anti_captcha/models/solution'
35
35
  require 'anti_captcha/models/image_to_text_solution'
36
36
  require 'anti_captcha/models/no_captcha_solution'
37
+ require 'anti_captcha/models/recaptcha_v3_solution'
37
38
  require 'anti_captcha/models/fun_captcha_solution'
38
39
  require 'anti_captcha/models/task_result'
39
40
  require 'anti_captcha/client'
@@ -111,6 +111,36 @@ module AntiCaptcha
111
111
  AntiCaptcha::NoCaptchaSolution.new(task_result)
112
112
  end
113
113
 
114
+ #
115
+ # Decodes a reCAPTCHA V3.
116
+ #
117
+ # @see `AntiCaptcha::Client#decode_recaptcha_v3!`
118
+ #
119
+ def decode_recaptcha_v3(options)
120
+ decode_recaptcha_v3!(options)
121
+ rescue
122
+ AntiCaptcha::RecaptchaV3Solution.new
123
+ end
124
+
125
+ #
126
+ # Decodes a reCAPTCHA V3. Proxy is not supported.
127
+ #
128
+ # @param [Hash] options Options hash.
129
+ # @option options [String] :website_url
130
+ # @option options [String] :website_key
131
+ # @option options [String] :min_score (one of 0.3, 0,5 or 0.7)
132
+ # @option options [String] :page_action
133
+ # @option options [String] :language_pool
134
+ #
135
+ # @return [AntiCaptcha::RecaptchaV3Solution] The solution of
136
+ # the reCAPTCHA V3.
137
+ #
138
+ def decode_recaptcha_v3!(options)
139
+ task = create_task!('RecaptchaV3TaskProxyless', options)
140
+ task_result = get_task_result!(task['taskId'])
141
+ AntiCaptcha::RecaptchaV3Solution.new(task_result)
142
+ end
143
+
114
144
  #
115
145
  # Decodes a FunCaptcha CAPTCHA.
116
146
  #
@@ -203,6 +233,15 @@ module AntiCaptcha
203
233
  websiteKey: options[:website_key],
204
234
  }
205
235
 
236
+ when 'RecaptchaV3TaskProxyless'
237
+ args[:task] = {
238
+ type: 'RecaptchaV3TaskProxyless',
239
+ websiteURL: options[:website_url],
240
+ websiteKey: options[:website_key],
241
+ minScore: options[:min_score].to_f,
242
+ pageAction: options[:page_action],
243
+ }
244
+
206
245
  when 'FunCaptchaTask'
207
246
  args[:task] = {
208
247
  type: 'FunCaptchaTask',
@@ -226,7 +265,7 @@ module AntiCaptcha
226
265
  proxyPort: proxy[:proxy_port],
227
266
  proxyLogin: proxy[:proxy_login],
228
267
  proxyPassword: proxy[:proxy_password],
229
- userAgent: proxy[:user_agent]
268
+ userAgent: proxy[:user_agent],
230
269
  )
231
270
  end
232
271
  end
@@ -272,10 +311,12 @@ module AntiCaptcha
272
311
  # tasks.
273
312
  #
274
313
  # @param [String] queue_id The ID of the queue. Options:
275
- # 1 - standart ImageToText, English language.
276
- # 2 - standart ImageToText, Russian language.
277
- # 5 - Recaptcha NoCaptcha tasks.
278
- # 6 - Recaptcha Proxyless task.
314
+ # 1 - standart ImageToText, English language.
315
+ # 2 - standart ImageToText, Russian language.
316
+ # 5 - Recaptcha NoCaptcha tasks.
317
+ # 6 - Recaptcha Proxyless task.
318
+ # 7 - Funcaptcha task.
319
+ # 10 - Funcaptcha Proxyless task.
279
320
  #
280
321
  # @return [Hash] Information about the queue.
281
322
  #
@@ -0,0 +1,14 @@
1
+ module AntiCaptcha
2
+ class RecaptchaV3Solution < AntiCaptcha::Solution
3
+ attr_accessor :g_recaptcha_response, :g_recaptcha_response_md5
4
+
5
+ def initialize(task_result = nil)
6
+ super
7
+
8
+ if task_result
9
+ @g_recaptcha_response = task_result.api_result['solution']['gRecaptchaResponse']
10
+ @g_recaptcha_response_md5 = task_result.api_result['solution']['gRecaptchaResponseMD5']
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,4 @@
1
1
  module AntiCaptcha
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.1"
3
3
  USER_AGENT = "AntiCaptcha/Ruby v#{VERSION}"
4
4
  end
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.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infosimples
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-21 00:00:00.000000000 Z
11
+ date: 2019-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: TwoCaptcha is an automated CAPTCHA solving service
55
+ description: Anti Captcha is an automated CAPTCHA solving service
56
56
  email:
57
57
  - team@infosimples.com.br
58
58
  executables: []
@@ -77,6 +77,7 @@ files:
77
77
  - lib/anti_captcha/models/fun_captcha_solution.rb
78
78
  - lib/anti_captcha/models/image_to_text_solution.rb
79
79
  - lib/anti_captcha/models/no_captcha_solution.rb
80
+ - lib/anti_captcha/models/recaptcha_v3_solution.rb
80
81
  - lib/anti_captcha/models/solution.rb
81
82
  - lib/anti_captcha/models/task_result.rb
82
83
  - lib/anti_captcha/version.rb
@@ -99,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  - !ruby/object:Gem::Version
100
101
  version: '0'
101
102
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.7.7
103
+ rubygems_version: 3.0.3
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Ruby API for Anti Captcha (CAPTCHA Solver as a Service)