ruby-2captcha 1.1.6 → 1.2.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/.rspec_status +16 -7
- data/.ruby-version +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +222 -4
- data/README.ru.md +227 -0
- data/api_2captcha.gemspec +1 -1
- data/examples/alibaba_example.rb +16 -0
- data/examples/altcha_example.rb +12 -0
- data/examples/amazon_waf_example.rb +14 -0
- data/examples/basilisk_example.rb +15 -0
- data/examples/binance_example.rb +17 -0
- data/examples/canvas_example.rb +13 -0
- data/examples/captchafox_example.rb +20 -0
- data/examples/capy_example.rb +11 -0
- data/examples/cloudflare_turnstile_example.rb +15 -0
- data/examples/coordinates_example.rb +12 -0
- data/examples/cut_captcha_example.rb +11 -0
- data/examples/cyber_siara_example.rb +10 -0
- data/examples/datadome_example.rb +12 -0
- data/examples/drag_drop_example.rb +24 -0
- data/examples/friendly_captcha_example.rb +10 -0
- data/examples/funcaptcha_example.rb +10 -0
- data/examples/geetest_example.rb +12 -0
- data/examples/geetest_v4_example.rb +10 -0
- data/examples/hcaptcha_example.rb +10 -0
- data/examples/hunt_example.rb +17 -0
- data/examples/imperva_example.rb +20 -0
- data/examples/key_captcha_example.rb +13 -0
- data/examples/lemin_example.rb +12 -0
- data/examples/media/drag_drop/background.jpeg +0 -0
- data/examples/media/drag_drop/image1.jpeg +0 -0
- data/examples/media/drag_drop/image2.jpeg +0 -0
- data/examples/media/temu/body.png +0 -0
- data/examples/media/temu/part1.png +0 -0
- data/examples/media/temu/part2.png +0 -0
- data/examples/media/temu/part3.png +0 -0
- data/examples/mt_captcha_example.rb +10 -0
- data/examples/normal_captcha_example.rb +4 -2
- data/examples/prosopo_example.rb +16 -0
- data/examples/recaptcha_v2_example.rb +1 -1
- data/examples/recaptcha_v3_example.rb +18 -0
- data/examples/rotate_example.rb +13 -0
- data/examples/temu_example.rb +28 -0
- data/examples/text_example.rb +23 -0
- data/examples/tspd_example.rb +19 -0
- data/examples/vkcaptcha_example.ru +10 -0
- data/examples/vkimage_example.rb +10 -0
- data/examples/yandex_example.rb +10 -0
- data/examples/yidun_example.rb +15 -0
- data/howto.txt +8 -0
- data/lib/api_2captcha/client.rb +87 -30
- data/lib/api_2captcha/version.rb +1 -1
- metadata +49 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
result = client.captchafox({
|
|
8
|
+
sitekey: "sk_vKdD8WGlPF5FKpRDs1U4qTuu6Jv0w",
|
|
9
|
+
pageurl: "https://sinscrire.gmx.fr/",
|
|
10
|
+
api_server: "https://mam.example.com",
|
|
11
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
|
12
|
+
proxytype: "socks5",
|
|
13
|
+
proxy: "u37d88e6957ca05d6-zone-custom-region-fr:u37d88e6957ca05d6@118.193.59.17:10743"
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
rescue StandardError => e
|
|
17
|
+
puts(e)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.capy({
|
|
6
|
+
sitekey: 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
|
|
7
|
+
pageurl: 'http://mysite.com/',
|
|
8
|
+
api_server: 'https://jp.api.capy.me/'
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.turnstile({
|
|
6
|
+
sitekey: "0x0AAAAAAADnPIDROzbs0Aaj",
|
|
7
|
+
data: "7fab0000b0e0ff00",
|
|
8
|
+
pagedata: "3gAFo2...0ME1UVT0=",
|
|
9
|
+
pageurl: "https://2captcha.com/",
|
|
10
|
+
action: "managed",
|
|
11
|
+
userAgent: "Mozilla/5.0 ... Chrome/116.0.0.0 Safari/537.36",
|
|
12
|
+
json: 1
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.coordinates({
|
|
6
|
+
image: 'path/to/captcha.jpg',
|
|
7
|
+
lang: 'en',
|
|
8
|
+
hint_image: 'path/to/hint.jpg',
|
|
9
|
+
hint_text: 'Connect the dots'
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.cutcaptcha({
|
|
6
|
+
misery_key: "a1488b66da00bf332a1488993a5443c79047e752",
|
|
7
|
+
api_key: "SAb83IIB",
|
|
8
|
+
pageurl: "https://example.cc/foo/bar.html"
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.data_dome({
|
|
6
|
+
pageurl: "https://test.com",
|
|
7
|
+
captcha_url: "https://test.com/captcha/",
|
|
8
|
+
proxytype: "http",
|
|
9
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require_relative "../lib/api_2captcha"
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new(ARGV[0])
|
|
4
|
+
|
|
5
|
+
# NOTE: images below are placeholder illustrations, not a real captcha demo.
|
|
6
|
+
backgroundFile = File.expand_path("../media/drag_drop/background.jpeg", __FILE__)
|
|
7
|
+
image1File = File.expand_path("../media/drag_drop/image1.jpeg", __FILE__)
|
|
8
|
+
image2File = File.expand_path("../media/drag_drop/image2.jpeg", __FILE__)
|
|
9
|
+
|
|
10
|
+
backgroundStr = Base64.strict_encode64(File.binread(backgroundFile))
|
|
11
|
+
image1Str = Base64.strict_encode64(File.binread(image1File))
|
|
12
|
+
image2Str = Base64.strict_encode64(File.binread(image2File))
|
|
13
|
+
|
|
14
|
+
begin
|
|
15
|
+
result = client.drag_drop({
|
|
16
|
+
body: backgroundStr,
|
|
17
|
+
images: [image1Str, image2Str],
|
|
18
|
+
textinstructions: "Drag the images to proper position"
|
|
19
|
+
})
|
|
20
|
+
rescue StandardError => e
|
|
21
|
+
puts(e)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.funcaptcha({
|
|
6
|
+
publickey: "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
|
|
7
|
+
pageurl: "https://mysite.com/page/with/funcaptcha",
|
|
8
|
+
surl: "https://client-api.arkoselabs.com"})
|
|
9
|
+
|
|
10
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.geetest({
|
|
6
|
+
gt: 'f1ab2cdefa3456789012345b6c78d90e',
|
|
7
|
+
api_server: 'api-na.geetest.com',
|
|
8
|
+
challenge: '12345678abc90123d45678ef90123a456b',
|
|
9
|
+
pageurl: 'https://www.site.com/page/'
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative "../lib/api_2captcha"
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new(ARGV[0])
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
result = client.hunt({
|
|
7
|
+
pageurl: "https://example.com/page-with-hunt",
|
|
8
|
+
api_get_lib: "https://example.com/hd-api/external/apps/app-id/api.js",
|
|
9
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
10
|
+
proxytype: "http",
|
|
11
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
12
|
+
})
|
|
13
|
+
rescue StandardError => e
|
|
14
|
+
puts(e)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
result = client.imperva({
|
|
8
|
+
pageurl: "https://example.com/page-with-imperva",
|
|
9
|
+
incapsula_script_url: "/_Incapsula_Resource?SWUDNSAI=31&xinfo=1",
|
|
10
|
+
incapsula_cookies: "visid_incap_123456=sample; incap_ses_123_123456=sample",
|
|
11
|
+
reese84_url_endpoint: "https://example.com/_Incapsula_Resource?reese84=1",
|
|
12
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
13
|
+
proxytype: "http",
|
|
14
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
15
|
+
})
|
|
16
|
+
rescue StandardError => e
|
|
17
|
+
puts(e)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.keycaptcha({
|
|
6
|
+
s_s_c_user_id: 10,
|
|
7
|
+
s_s_c_session_id: '493e52c37c10c2bcdf4a00cbc9ccd1e8',
|
|
8
|
+
s_s_c_web_server_sign: '9006dc725760858e4c0715b835472f22-pz-',
|
|
9
|
+
s_s_c_web_server_sign2: '2ca3abe86d90c6142d5571db98af6714',
|
|
10
|
+
pageurl: 'https://www.keycaptcha.ru/demo-magnetic/'
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.lemin({
|
|
6
|
+
captcha_id: 'CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
|
|
7
|
+
div_id: 'lemin-cropped-captcha',
|
|
8
|
+
pageurl: 'https://www.site.com/page/',
|
|
9
|
+
api_server: "https://api.leminnow.com/"
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
puts "Result: #{result.inspect}"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
require 'api_2captcha'
|
|
2
2
|
|
|
3
|
-
client = Api2Captcha.new(
|
|
3
|
+
client = Api2Captcha.new(ARGV[0])
|
|
4
|
+
|
|
5
|
+
image_absolute_path = File.expand_path("../media/normal_2.jpg", __FILE__)
|
|
4
6
|
|
|
5
7
|
result = client.normal({
|
|
6
|
-
image:
|
|
8
|
+
image: image_absolute_path,
|
|
7
9
|
})
|
|
8
10
|
|
|
9
11
|
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
result = client.prosopo({
|
|
8
|
+
pageurl: "https://www.twickets.live/",
|
|
9
|
+
sitekey: "5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm",
|
|
10
|
+
})
|
|
11
|
+
rescue StandardError => e
|
|
12
|
+
puts(e)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require_relative '../lib/api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new(ARGV[0])
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
result = client.recaptcha_v3({
|
|
7
|
+
googlekey: "6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u",
|
|
8
|
+
pageurl: "http://2captcha.com/demo/recaptcha-v3",
|
|
9
|
+
version: "v3",
|
|
10
|
+
score: 0.3,
|
|
11
|
+
action: "verify"
|
|
12
|
+
})
|
|
13
|
+
rescue StandardError => e
|
|
14
|
+
puts(e)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.rotate({
|
|
6
|
+
image: 'path/to/captcha.jpg',
|
|
7
|
+
angle: 40,
|
|
8
|
+
lang: 'en',
|
|
9
|
+
hint_image: 'path/to/hint.jpg',
|
|
10
|
+
hint_text: 'Put the images in the correct way'
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
bodyFile = File.expand_path("../media/temu/body.png", __FILE__)
|
|
7
|
+
part1File = File.expand_path("../media/temu/part1.png", __FILE__)
|
|
8
|
+
part2File = File.expand_path("../media/temu/part2.png", __FILE__)
|
|
9
|
+
part3File = File.expand_path("../media/temu/part3.png", __FILE__)
|
|
10
|
+
|
|
11
|
+
bodyStr = Base64.strict_encode64(File.binread(bodyFile))
|
|
12
|
+
part1Str = Base64.strict_encode64(File.binread(part1File))
|
|
13
|
+
part2Str = Base64.strict_encode64(File.binread(part2File))
|
|
14
|
+
part3Str = Base64.strict_encode64(File.binread(part3File))
|
|
15
|
+
|
|
16
|
+
begin
|
|
17
|
+
result = client.temu({
|
|
18
|
+
body: bodyStr,
|
|
19
|
+
part1: part1Str,
|
|
20
|
+
part2: part2Str,
|
|
21
|
+
part3: part3Str,
|
|
22
|
+
})
|
|
23
|
+
rescue StandardError => e
|
|
24
|
+
puts(e)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "api_2captcha"
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new(ARGV[0])
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
result = client.text({
|
|
7
|
+
textcaptcha: "If tomorrow is Saturday, what day is today?",
|
|
8
|
+
lang: "en"
|
|
9
|
+
})
|
|
10
|
+
puts "Result: #{result.inspect}"
|
|
11
|
+
rescue Api2Captcha::ValidationException => e
|
|
12
|
+
# invalid parameters passed
|
|
13
|
+
puts(e)
|
|
14
|
+
rescue Api2Captcha::NetworkException => e
|
|
15
|
+
# network error occurred
|
|
16
|
+
puts(e)
|
|
17
|
+
rescue Api2Captcha::ApiException => e
|
|
18
|
+
# api respond with error
|
|
19
|
+
puts(e)
|
|
20
|
+
rescue Api2Captcha::TimeoutException => e
|
|
21
|
+
# captcha is not solved so far
|
|
22
|
+
puts(e)
|
|
23
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
result = client.tspd({
|
|
8
|
+
pageurl: "https://example.com/page-with-tspd",
|
|
9
|
+
tspd_cookie: "TS...",
|
|
10
|
+
html_page_base64: "PGh0bWw+...",
|
|
11
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
12
|
+
proxytype: "http",
|
|
13
|
+
proxy: "proxyuser:strongPassword@123.123.123.123:3128"
|
|
14
|
+
})
|
|
15
|
+
rescue StandardError => e
|
|
16
|
+
puts(e)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'api_2captcha'
|
|
2
|
+
|
|
3
|
+
client = Api2Captcha.new("YOUR_API_KEY")
|
|
4
|
+
|
|
5
|
+
result = client.vkcaptcha({
|
|
6
|
+
redirect_uri: 'https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1',
|
|
7
|
+
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
puts "Result: #{result.inspect}"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative '../lib/api_2captcha'
|
|
3
|
+
|
|
4
|
+
client = Api2Captcha.new(ARGV[0])
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
result = client.yidun({
|
|
8
|
+
pageurl: "https://example.com/page-with-yidun",
|
|
9
|
+
sitekey: "SITE_KEY"
|
|
10
|
+
})
|
|
11
|
+
rescue StandardError => e
|
|
12
|
+
puts(e)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
puts "Result: #{result.inspect}"
|