two_captcha 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/two_captcha/client.rb +9 -21
- data/lib/two_captcha/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d9f28e64ed32b2c3bb8973f14bea2dbb15828550806d0306e6bdbdf07815562
|
4
|
+
data.tar.gz: eaa46657370a298929c7e5f49104abb3f696a74cddeddb8f1052a1f3c2140b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/two_captcha/client.rb
CHANGED
@@ -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
|
22
|
-
self.timeout
|
23
|
-
self.polling
|
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:
|
156
|
-
version:
|
157
|
-
|
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::
|
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
|
data/lib/two_captcha/version.rb
CHANGED
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.
|
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-
|
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.
|
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)
|