ruby-2captcha 1.0.5 → 1.1.1
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 +8 -3
- data/lib/api_2captcha/client.rb +10 -8
- data/lib/api_2captcha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b8573fa19c5140ac8f5349c4604646c596a332efe75fb5e41fb5d41a33d9512
|
4
|
+
data.tar.gz: 641044d2134a3b3f5c5d0530c0f8f977df93d32a6abbb790a6fdfe38db02221a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9d441e40359ae1f03e2afd1e30c948765129486e5821c62d41eeb4f1933025a80dd553dd9fce9ed2a77c907e1278570756e973bfe78d20ffeff5a6b04a4114
|
7
|
+
data.tar.gz: a426dafc2ef4b6332f5b79f6b811be0b287003b8322135a12be0c0661aa99be00560c91d31476122b2de99fa494306833c56904b6f8733090d8498e1e7df587d
|
data/README.md
CHANGED
@@ -273,11 +273,16 @@ result = client.lemin({
|
|
273
273
|
```
|
274
274
|
|
275
275
|
### Cloudflare Turnstile
|
276
|
-
Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
|
276
|
+
Use this method to solve Cloudflare Turnstile. Returns JSON with the token and User-Agent.
|
277
277
|
```ruby
|
278
278
|
result = client.turnstile({
|
279
|
-
sitekey:
|
280
|
-
|
279
|
+
sitekey: "0x0AAAAAAADnPIDROzbs0Aaj",
|
280
|
+
data: "7fab0000b0e0ff00",
|
281
|
+
pagedata: "3gAFo2...0ME1UVT0=",
|
282
|
+
pageurl: "https://2captcha.com/",
|
283
|
+
action: "managed",
|
284
|
+
userAgent: "Mozilla/5.0 ... Chrome/116.0.0.0 Safari/537.36",
|
285
|
+
json: 1
|
281
286
|
})
|
282
287
|
```
|
283
288
|
|
data/lib/api_2captcha/client.rb
CHANGED
@@ -27,7 +27,8 @@ module Api2Captcha
|
|
27
27
|
@domain = DEFAULT_DOMAIN
|
28
28
|
end
|
29
29
|
|
30
|
-
def solve(method,
|
30
|
+
def solve(method, return_id: false, **params)
|
31
|
+
params = params.transform_keys(&:to_s)
|
31
32
|
params["method"] = method
|
32
33
|
params["key"] = @api_key
|
33
34
|
params["soft_id"] = @soft_id
|
@@ -70,7 +71,8 @@ module Api2Captcha
|
|
70
71
|
when Net::HTTPSuccess
|
71
72
|
response_json = JSON.parse(response.body)
|
72
73
|
if response_json["status"] == 1
|
73
|
-
|
74
|
+
response_json["captcha_id"] = captcha_id
|
75
|
+
return response_json
|
74
76
|
elsif response_json["request"] == "CAPCHA_NOT_READY"
|
75
77
|
sleep(polling_interval)
|
76
78
|
else
|
@@ -169,12 +171,12 @@ module Api2Captcha
|
|
169
171
|
end
|
170
172
|
|
171
173
|
def audio(params)
|
172
|
-
audio = params.delete(
|
174
|
+
audio = params.delete("audio")
|
173
175
|
audio_content = File.file?(audio) ? File.binread(audio) : audio
|
174
176
|
|
175
177
|
params = params.merge(
|
176
178
|
"body" => Base64.strict_encode64(audio_content),
|
177
|
-
"lang" => params[
|
179
|
+
"lang" => params["lang"]
|
178
180
|
)
|
179
181
|
solve("audio", params)
|
180
182
|
end
|
@@ -198,12 +200,12 @@ module Api2Captcha
|
|
198
200
|
end
|
199
201
|
|
200
202
|
def get_params(params)
|
201
|
-
params[
|
203
|
+
params["image"].nil? ? params : file_params(params)
|
202
204
|
end
|
203
205
|
|
204
206
|
def file_params(params)
|
205
|
-
image = params.delete(
|
206
|
-
hint_image = params.delete(
|
207
|
+
image = params.delete("image")
|
208
|
+
hint_image = params.delete("hint_image")
|
207
209
|
|
208
210
|
image_content = get_image_content(image)
|
209
211
|
hint_image_content = get_image_content(hint_image) if hint_image
|
@@ -245,7 +247,7 @@ module Api2Captcha
|
|
245
247
|
if response_json["status"] == 1
|
246
248
|
response_json["request"]
|
247
249
|
else
|
248
|
-
raise ApiException, "API Error: #{response_json["
|
250
|
+
raise ApiException, "API Error: #{response_json["request"]}"
|
249
251
|
end
|
250
252
|
else
|
251
253
|
raise NetworkException, "Network Error: #{response.code.to_i}"
|
data/lib/api_2captcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-2captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 2captcha.com
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby package for easy integration with the API of 2captcha captcha solving
|
14
14
|
service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
|