ruby-2captcha 1.1.4 → 1.1.6
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/Gemfile.lock +5 -5
- data/README.md +256 -75
- data/README.ru.md +288 -80
- data/api_2captcha.gemspec +3 -0
- data/examples/atb_captcha_example.rb +11 -0
- data/examples/audio_example.rb +10 -0
- data/examples/grid_captcha_example.rb +14 -0
- data/examples/media/example.mp3 +0 -0
- data/examples/media/normal_2.jpg +0 -0
- data/examples/media/recaptchaGrid4x4.jpg +0 -0
- data/examples/media/recaptchaGridImginstructions4x4.jpg +0 -0
- data/examples/normal_captcha_example.rb +9 -0
- data/examples/recaptcha_v2_example.rb +10 -0
- data/examples/tencent_example.rb +10 -0
- data/lib/api_2captcha/client.rb +31 -7
- data/lib/api_2captcha/version.rb +1 -1
- metadata +16 -2
Binary file
|
Binary file
|
Binary file
|
data/lib/api_2captcha/client.rb
CHANGED
@@ -23,7 +23,7 @@ module Api2Captcha
|
|
23
23
|
@default_timeout = 120
|
24
24
|
@recaptcha_timeout = 600
|
25
25
|
@polling_interval = 10
|
26
|
-
@soft_id =
|
26
|
+
@soft_id = 4584
|
27
27
|
@domain = DEFAULT_DOMAIN
|
28
28
|
end
|
29
29
|
|
@@ -134,7 +134,7 @@ module Api2Captcha
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def grid(params)
|
137
|
-
params[
|
137
|
+
params[:recaptcha] = 1
|
138
138
|
solve("post", **params)
|
139
139
|
end
|
140
140
|
|
@@ -171,7 +171,7 @@ module Api2Captcha
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def audio(params)
|
174
|
-
audio = params.delete(
|
174
|
+
audio = params.delete(:audio)
|
175
175
|
audio_content = File.file?(audio) ? File.binread(audio) : audio
|
176
176
|
|
177
177
|
params = params.merge(
|
@@ -201,6 +201,18 @@ module Api2Captcha
|
|
201
201
|
solve("friendly_captcha", **params)
|
202
202
|
end
|
203
203
|
|
204
|
+
def cutcaptcha(params)
|
205
|
+
solve("cutcaptcha", **params)
|
206
|
+
end
|
207
|
+
|
208
|
+
def tencent(params)
|
209
|
+
solve("tencent", **params)
|
210
|
+
end
|
211
|
+
|
212
|
+
def atb_captcha(params)
|
213
|
+
solve("atb_captcha", **params)
|
214
|
+
end
|
215
|
+
|
204
216
|
private
|
205
217
|
|
206
218
|
def base_url
|
@@ -223,16 +235,24 @@ module Api2Captcha
|
|
223
235
|
image = params.delete("image")
|
224
236
|
hint_image = params.delete("hint_image")
|
225
237
|
|
226
|
-
image_content =
|
227
|
-
|
238
|
+
image_content = if base64_encoded?(image)
|
239
|
+
image
|
240
|
+
else
|
241
|
+
Base64.strict_encode64(get_image_content(image))
|
242
|
+
end
|
243
|
+
|
244
|
+
hint_image_content = if hint_image
|
245
|
+
base64_encoded?(hint_image) ? hint_image : Base64.strict_encode64(get_image_content(hint_image))
|
246
|
+
end
|
247
|
+
|
228
248
|
result_params = {
|
229
249
|
"method" => "base64",
|
230
|
-
"body" =>
|
250
|
+
"body" => image_content,
|
231
251
|
"filename" => File.basename(image),
|
232
252
|
"ext" => File.extname(image).delete(".")
|
233
253
|
}
|
234
254
|
|
235
|
-
result_params["imginstructions"] =
|
255
|
+
result_params["imginstructions"] = hint_image_content if hint_image_content
|
236
256
|
params.merge(result_params)
|
237
257
|
end
|
238
258
|
|
@@ -242,6 +262,10 @@ module Api2Captcha
|
|
242
262
|
image
|
243
263
|
end
|
244
264
|
|
265
|
+
def base64_encoded?(string)
|
266
|
+
string.is_a?(String) && string.match(/\A[A-Za-z0-9+\/=]+\z/) && (string.length % 4).zero?
|
267
|
+
end
|
268
|
+
|
245
269
|
def download_image(url)
|
246
270
|
response = URI.open(url)
|
247
271
|
if response.status[0] != '200'
|
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.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 2captcha.com
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-20 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.
|
@@ -29,6 +29,16 @@ files:
|
|
29
29
|
- README.ru.md
|
30
30
|
- Rakefile
|
31
31
|
- api_2captcha.gemspec
|
32
|
+
- examples/atb_captcha_example.rb
|
33
|
+
- examples/audio_example.rb
|
34
|
+
- examples/grid_captcha_example.rb
|
35
|
+
- examples/media/example.mp3
|
36
|
+
- examples/media/normal_2.jpg
|
37
|
+
- examples/media/recaptchaGrid4x4.jpg
|
38
|
+
- examples/media/recaptchaGridImginstructions4x4.jpg
|
39
|
+
- examples/normal_captcha_example.rb
|
40
|
+
- examples/recaptcha_v2_example.rb
|
41
|
+
- examples/tencent_example.rb
|
32
42
|
- lib/api_2captcha.rb
|
33
43
|
- lib/api_2captcha/api2captcha_exceptions.rb
|
34
44
|
- lib/api_2captcha/client.rb
|
@@ -42,6 +52,10 @@ metadata:
|
|
42
52
|
source_code_uri: https://github.com/2captcha/2captcha-ruby
|
43
53
|
changelog_uri: https://github.com/2captcha/2captcha-ruby/releases
|
44
54
|
github_repo: ssh://github.com/2captcha/2captcha-ruby
|
55
|
+
bug_tracker_uri: https://github.com/2captcha/2captcha-ruby/issues
|
56
|
+
keywords: 2captcha, captcha solver, captcha bypass, Ruby, automation, CAPTCHA API,
|
57
|
+
CAPTCHA recognition, anti-captcha, reCAPTCHA, OCR, image recognition, human verification,
|
58
|
+
bot protection, recaptcha
|
45
59
|
post_install_message:
|
46
60
|
rdoc_options: []
|
47
61
|
require_paths:
|