deathbycaptcha 5.0.3 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +8 -2
- data/deathbycaptcha.gemspec +1 -1
- data/lib/deathbycaptcha.rb +1 -0
- data/lib/deathbycaptcha/client.rb +3 -1
- data/lib/deathbycaptcha/client/http.rb +3 -6
- data/lib/deathbycaptcha/client/socket.rb +1 -2
- data/lib/deathbycaptcha/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6ef707ded08cf2e5826a2ff2310e1d6a884f308
|
4
|
+
data.tar.gz: 362f504f17b6b1b51ca90ec0e1a172fee7357017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b9136e1d4ad73486ab74dd6706701e96e66905a44c0e5e206a3b0bd0c29261e4747ac50e4d4155fcfd78cdfab81d7baf707805656cc856764adfed970f44c21
|
7
|
+
data.tar.gz: 041bdb89d9c817dcef99820a4ccfe2f70fc566a93e970a4cb8bfc9b893991b44612c6d578fac3ce30f9385cf7dfc6550aa535830d4d7a05b546415b62415ba82
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Developed by [Infosimples](https://infosimples.com), a brazilian company that
|
2
|
-
offers [data extraction solutions](https://infosimples.com/en/data-engineering)
|
3
|
-
|
2
|
+
offers [data extraction solutions](https://infosimples.com/en/data-engineering).
|
3
|
+
|
4
|
+
We suggest you to also check [2Captcha.com](http://2captcha.com/?from=1025109)
|
5
|
+
for a cheaper service. You can find it's gem fully compatible with the
|
6
|
+
deathbycaptcha gem at https://github.com/infosimples/two_captcha.
|
7
|
+
|
8
|
+
[Contact us](https://infosimples.com/en) if you need enterprise services for
|
9
|
+
CAPTCHAs solving or Internet automation.
|
4
10
|
|
5
11
|
|
6
12
|
# DeathByCaptcha
|
data/deathbycaptcha.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'deathbycaptcha/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "deathbycaptcha"
|
8
8
|
spec.version = DeathByCaptcha::VERSION
|
9
|
-
spec.authors = ["Débora Setton Fernandes, Rafael Barbolo, Rafael Ivan Garcia"]
|
9
|
+
spec.authors = ["Débora Setton Fernandes, Marcelo Mita, Rafael Barbolo, Rafael Ivan Garcia"]
|
10
10
|
spec.email = ["team@infosimples.com.br"]
|
11
11
|
spec.summary = %q{Ruby API for DeathByCaptcha (Captcha Solver as a Service)}
|
12
12
|
spec.description = %q{DeathByCaptcha allows you to solve captchas with manual labor}
|
data/lib/deathbycaptcha.rb
CHANGED
@@ -12,7 +12,7 @@ module DeathByCaptcha
|
|
12
12
|
#
|
13
13
|
class Client
|
14
14
|
|
15
|
-
attr_accessor :username, :password, :timeout, :polling
|
15
|
+
attr_accessor :username, :password, :timeout, :polling, :hostname
|
16
16
|
|
17
17
|
# Create a DeathByCaptcha API client
|
18
18
|
#
|
@@ -43,6 +43,7 @@ module DeathByCaptcha
|
|
43
43
|
# @param [Hash] options Options hash.
|
44
44
|
# @option options [Integer] :timeout (60) Seconds before giving up.
|
45
45
|
# @option options [Integer] :polling (5) Seconds for polling the solution.
|
46
|
+
# @option options [String] :hostname ('api.dbcapi.me') Custom API hostname.
|
46
47
|
#
|
47
48
|
# @return [DeathByCaptcha::Client] A Client instance.
|
48
49
|
#
|
@@ -51,6 +52,7 @@ module DeathByCaptcha
|
|
51
52
|
self.password = password
|
52
53
|
self.timeout = options[:timeout] || 60
|
53
54
|
self.polling = options[:polling] || 5
|
55
|
+
self.hostname = options[:hostname] || 'api.dbcapi.me'
|
54
56
|
end
|
55
57
|
|
56
58
|
# Decode the text from an image (i.e. solve a captcha).
|
@@ -3,9 +3,6 @@ module DeathByCaptcha
|
|
3
3
|
# HTTP client for DeathByCaptcha API.
|
4
4
|
#
|
5
5
|
class Client::HTTP < Client
|
6
|
-
|
7
|
-
BASE_URL = 'http://api.dbcapi.me/api'
|
8
|
-
|
9
6
|
# Retrieve information from an uploaded captcha.
|
10
7
|
#
|
11
8
|
# @param [Integer] captcha_id Numeric ID of the captcha.
|
@@ -86,18 +83,18 @@ module DeathByCaptcha
|
|
86
83
|
headers = { 'User-Agent' => DeathByCaptcha::API_VERSION }
|
87
84
|
|
88
85
|
if method == :post
|
89
|
-
uri = URI("
|
86
|
+
uri = URI("http://#{self.hostname}/api/#{action}")
|
90
87
|
req = Net::HTTP::Post.new(uri.request_uri, headers)
|
91
88
|
req.set_form_data(payload)
|
92
89
|
|
93
90
|
elsif method == :post_multipart
|
94
|
-
uri = URI("
|
91
|
+
uri = URI("http://#{self.hostname}/api/#{action}")
|
95
92
|
req = Net::HTTP::Post.new(uri.request_uri, headers)
|
96
93
|
boundary, body = prepare_multipart_data(payload)
|
97
94
|
req.content_type = "multipart/form-data; boundary=#{boundary}"
|
98
95
|
req.body = body
|
99
96
|
else
|
100
|
-
uri = URI("
|
97
|
+
uri = URI("http://#{self.hostname}/api/#{action}?#{URI.encode_www_form(payload)}")
|
101
98
|
req = Net::HTTP::Get.new(uri.request_uri, headers)
|
102
99
|
end
|
103
100
|
|
@@ -4,7 +4,6 @@ module DeathByCaptcha
|
|
4
4
|
#
|
5
5
|
class Client::Socket < Client
|
6
6
|
|
7
|
-
HOST = 'api.dbcapi.me'
|
8
7
|
PORTS = (8123..8130).to_a
|
9
8
|
|
10
9
|
# Retrieve information from an uploaded captcha.
|
@@ -116,7 +115,7 @@ module DeathByCaptcha
|
|
116
115
|
#
|
117
116
|
def create_socket
|
118
117
|
socket = ::Socket.new(::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)
|
119
|
-
sockaddr = ::Socket.sockaddr_in(PORTS.sample,
|
118
|
+
sockaddr = ::Socket.sockaddr_in(PORTS.sample, self.hostname)
|
120
119
|
begin # emulate blocking connect
|
121
120
|
socket.connect_nonblock(sockaddr)
|
122
121
|
rescue IO::WaitWritable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deathbycaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Débora Setton Fernandes, Rafael Barbolo, Rafael Ivan Garcia
|
7
|
+
- Débora Setton Fernandes, Marcelo Mita, Rafael Barbolo, Rafael Ivan Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|