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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c633b9bb114866ddf802c7420e8c44d737dffd
4
- data.tar.gz: f940fb9797a688edebe3b90da31dbff445c1a27a
3
+ metadata.gz: c6ef707ded08cf2e5826a2ff2310e1d6a884f308
4
+ data.tar.gz: 362f504f17b6b1b51ca90ec0e1a172fee7357017
5
5
  SHA512:
6
- metadata.gz: 8dcf6fe8b34118de125bb698ffeabab7297631cdd7e740a63269e408c76555068a91232814e4e6417b4a83a4fb7db5be911e8273cf2f2f07455be5bab0e74683
7
- data.tar.gz: 8fe87517c20ad3bd5bb1a3181c81d2fb2ba02658b4eeadad6e600d2b872ac1136eba1737a163f5bd306f8ebf072f14611e249390a02bbcf3feaa7be22a7dc3de
6
+ metadata.gz: 3b9136e1d4ad73486ab74dd6706701e96e66905a44c0e5e206a3b0bd0c29261e4747ac50e4d4155fcfd78cdfab81d7baf707805656cc856764adfed970f44c21
7
+ data.tar.gz: 041bdb89d9c817dcef99820a4ccfe2f70fc566a93e970a4cb8bfc9b893991b44612c6d578fac3ce30f9385cf7dfc6550aa535830d4d7a05b546415b62415ba82
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Rafael Barbolo
1
+ Copyright (c) 2015 Infosimples
2
2
 
3
3
  MIT License
4
4
 
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
- and [Ruby on Rails development](https://infosimples.com/en/software-development).
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
@@ -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}
@@ -1,4 +1,5 @@
1
1
  require 'base64'
2
+ require 'openssl'
2
3
  require 'json'
3
4
  require 'bigdecimal'
4
5
  require 'socket'
@@ -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("#{BASE_URL}/#{action}")
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("#{BASE_URL}/#{action}")
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("#{BASE_URL}/#{action}?#{URI.encode_www_form(payload)}")
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, HOST)
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
@@ -1,4 +1,4 @@
1
1
  module DeathByCaptcha
2
- VERSION = "5.0.3"
2
+ VERSION = "5.0.4"
3
3
  API_VERSION = "DBC/Ruby v#{VERSION}"
4
4
  end
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.3
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: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler