two_captcha 1.6.0 → 1.7.0

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: 85dec926f62d43f6629fea1232276b55950cac27c107e64d064f6374f571c6b6
4
- data.tar.gz: 9e962be8d8d1dd76f6cfe7644003a042b3bcccf216aa5d820fd057c95d930c22
3
+ metadata.gz: 9d9f28e64ed32b2c3bb8973f14bea2dbb15828550806d0306e6bdbdf07815562
4
+ data.tar.gz: eaa46657370a298929c7e5f49104abb3f696a74cddeddb8f1052a1f3c2140b8d
5
5
  SHA512:
6
- metadata.gz: 11dc25d38866f051f13963f460c9b8d5b813d0960b4f1ce8fa3b0c589555d368021cae3994cd1e9d0e6f730940a6921fa91173a70e48a29ec25b7a3903ac814e
7
- data.tar.gz: 762fd992e1b9fa35cfc91baf729d280d123298a46f92b75a6dc03e3b42294184d3a4c84cfc449b5d6d44615f54434c5a1d9c0b565ce1ab7d310cf907996b0d50
6
+ metadata.gz: cc567f2ecf5c0771e1b1ca7cade9c44a33abe2a224256132d2d8326798b998f5b8750fdbb489995c320a705f68ed7d9bb685450c87174c71389d987eb06258a0
7
+ data.tar.gz: dac73380663bc6471b233db9b30a6d2be296b27fa92131a3beaf54f7a155d503658c7ad53accf1e500eb50704413bd9af931793f6ccc200251dce157f5dbe1f3
data/README.md CHANGED
@@ -223,6 +223,21 @@ following:
223
223
  captcha.text # Solution of the captcha
224
224
  ```
225
225
 
226
+ ## Using proxy or other custom options
227
+
228
+ You are allowed to use custom options like `proxy`, `proxytype` or `userAgent` whenever the 2Captcha API supports it. Example:
229
+
230
+ ```ruby
231
+ options = {
232
+ sitekey: 'xyz',
233
+ pageurl: 'http://example.com/example=1',
234
+ proxy: 'login:password@123.123.123.123:3128',
235
+ userAgent: 'user agent'
236
+ }
237
+
238
+ captcha = client.decode_hcaptcha!(options)
239
+ ```
240
+
226
241
  ## Notes
227
242
 
228
243
  #### Thread-safety
@@ -18,9 +18,9 @@ module TwoCaptcha
18
18
  # @return [TwoCaptcha::Client] A Client instance.
19
19
  #
20
20
  def initialize(key, options = {})
21
- self.key = key
22
- self.timeout = options[:timeout] || 60
23
- self.polling = options[:polling] || 5
21
+ self.key = key
22
+ self.timeout = options[:timeout] || 60
23
+ self.polling = options[:polling] || 5
24
24
  end
25
25
 
26
26
  # Decode the text from an image (i.e. solve a captcha).
@@ -105,11 +105,7 @@ module TwoCaptcha
105
105
 
106
106
  fail(TwoCaptcha::GoogleKey) if options[:googlekey].empty?
107
107
 
108
- upload_options = {
109
- method: 'userrecaptcha',
110
- googlekey: options[:googlekey],
111
- pageurl: options[:pageurl]
112
- }
108
+ upload_options = { method: 'userrecaptcha' }.merge(options)
113
109
  decoded_captcha = upload(upload_options)
114
110
 
115
111
  # pool untill the answer is ready
@@ -152,13 +148,9 @@ module TwoCaptcha
152
148
  fail(TwoCaptcha::GoogleKey) if options[:googlekey].empty?
153
149
 
154
150
  upload_options = {
155
- method: 'userrecaptcha',
156
- version: 'v3',
157
- googlekey: options[:googlekey],
158
- pageurl: options[:pageurl],
159
- action: options[:action],
160
- min_score: options[:min_score]
161
- }
151
+ method: 'userrecaptcha',
152
+ version: 'v3',
153
+ }.merge(options)
162
154
  decoded_captcha = upload(upload_options)
163
155
 
164
156
  # pool untill the answer is ready
@@ -196,13 +188,9 @@ module TwoCaptcha
196
188
  def decode_hcaptcha!(options = {})
197
189
  started_at = Time.now
198
190
 
199
- fail(TwoCaptcha::GoogleKey) if options[:sitekey].empty?
191
+ fail(TwoCaptcha::SiteKey) if options[:sitekey].empty?
200
192
 
201
- upload_options = {
202
- method: 'hcaptcha',
203
- sitekey: options[:sitekey],
204
- pageurl: options[:pageurl]
205
- }
193
+ upload_options = { method: 'hcaptcha' }.merge(options)
206
194
  decoded_captcha = upload(upload_options)
207
195
 
208
196
  # pool untill the answer is ready
@@ -1,4 +1,4 @@
1
1
  module TwoCaptcha
2
- VERSION = '1.6.0'
2
+ VERSION = '1.7.0'
3
3
  USER_AGENT = "TwoCaptcha/Ruby v#{VERSION}"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: two_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Barbolo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-26 00:00:00.000000000 Z
12
+ date: 2021-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.6
106
+ rubygems_version: 3.1.4
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Ruby API for 2Captcha (Captcha Solver as a Service)