two_captcha 1.1.0 → 1.2.0

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: 055315d1b7cfb0bafcb2542dcdf1996ed273753d
4
- data.tar.gz: 62bba1e3f36d178aa38f7a860f50124740d938a7
3
+ metadata.gz: b2779681253ef270666b343ac55f430b790229a1
4
+ data.tar.gz: e02d828d5a7af4d3707ff246f8fbadf85ad012c1
5
5
  SHA512:
6
- metadata.gz: 0023a248fbba3ed1af6a714256b3e61ad91616145d2b5db1d5edea2e7da87cebe8c6d88f7e706425c411b3b0e92c4b362207237d04f8312bc79401e3dc6466c6
7
- data.tar.gz: 3c161aa8ef5031a56d33873da65c27f474aa6a07999a530e3f39982158841f381baa479e8cf2c32dbe41822f58ecf6ea6ce8312218f11c405eb9ce46d24dbc76
6
+ metadata.gz: 7b5c68c961ebd3f92dfd265ec3489ae772430fcf16b51f6486adcd46befc360c0e0ad6adbd034734500afedc24728210cc7a1fe3b6da8b9c02ee503636087e0a
7
+ data.tar.gz: 67dc5d2753dc923afc74ef5b30f10b950488d1c76f2440e129c083a3b385afe72b0aed30baa42afb748bb78b1f68ec9729ee6c290a82b80ef5e2b56c7b26cc82
data/README.md CHANGED
@@ -118,9 +118,17 @@ more information.
118
118
  The response will be an array containing coordinates where the captcha should be
119
119
  clicked. For the captcha above it should look something like:
120
120
 
121
+ ## Audio reCAPTCHA v2
122
+
123
+ ```ruby
124
+ client.decode(url: 'http://bit.ly/audiorecaptchav2', recaptchavoice: 1)
125
+ ```
126
+
127
+ The response will be a simple text:
128
+
121
129
  ```ruby
122
- # captcha.coordinates
123
- [[234, 330], [48, 137]]
130
+ # captcha.text
131
+ '61267'
124
132
  ```
125
133
 
126
134
  ## Notes
data/captchas/3.mp3 ADDED
Binary file
@@ -55,7 +55,7 @@ module TwoCaptcha
55
55
  # @option options [Integer] :language (0) https://2captcha.com/setting
56
56
  # @option options [Integer] :header_acao (0) https://2captcha.com/setting
57
57
  # @option options [Integer] :id_constructor (0) 23 if new reCAPTCHA.
58
- # @option options [Integer] coordinatescaptcha (0) 1 if clickable captcha.
58
+ # @option options [Integer] :coordinatescaptcha (0) 1 if clickable captcha.
59
59
  #
60
60
  # @return [TwoCaptcha::Captcha] The captcha (with solution) if an error is
61
61
  # not raised.
@@ -88,10 +88,7 @@ module TwoCaptcha
88
88
  args = {}
89
89
  args[:body] = options[:raw64]
90
90
  args[:method] = 'base64'
91
- [:phrase, :regsense, :numeric, :calc, :min_len, :max_len, :language,
92
- :header_acao, :id_constructor, :coordinatescaptcha].each do |key|
93
- args[key] = options[key] if options[key]
94
- end
91
+ args.merge!(options)
95
92
  response = request('in', :multipart, args)
96
93
 
97
94
  unless response.match(/\AOK\|/)
@@ -1,4 +1,4 @@
1
1
  module TwoCaptcha
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  USER_AGENT = "TwoCaptcha/Ruby v#{VERSION}"
4
4
  end
@@ -5,6 +5,7 @@ captcha_id = CREDENTIALS['captcha_id']
5
5
  captcha_solution = CREDENTIALS['solution']
6
6
  image64 = Base64.encode64(File.open('captchas/1.png', 'rb').read)
7
7
  clickable64 = Base64.encode64(File.open('captchas/2.jpg', 'rb').read)
8
+ audio64 = Base64.encode64(File.open('captchas/3.mp3', 'rb').read)
8
9
 
9
10
  describe TwoCaptcha::Client do
10
11
  describe 'create' do
@@ -77,4 +78,18 @@ describe TwoCaptcha::Client do
77
78
  it { expect(@xy2[1]).to be_between(276, 366).inclusive }
78
79
  end
79
80
  end
81
+
82
+ context 'audio reCAPTCHA v2' do
83
+ before(:all) { @client = TwoCaptcha.new(key) }
84
+
85
+ describe '#decode!' do
86
+ before(:all) do
87
+ @captcha = @client.decode!(raw64: audio64, recaptchavoice: 1)
88
+ end
89
+
90
+ it { expect(@captcha).to be_a(TwoCaptcha::Captcha) }
91
+ it { expect(@captcha.text.downcase).to eq '61267' }
92
+ it { expect(@captcha.id).to match(/[0-9]{9}/) }
93
+ end
94
+ end
80
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: two_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Mita
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-09 00:00:00.000000000 Z
12
+ date: 2016-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - bin/setup
75
75
  - captchas/1.png
76
76
  - captchas/2.jpg
77
+ - captchas/3.mp3
77
78
  - lib/two_captcha.rb
78
79
  - lib/two_captcha/client.rb
79
80
  - lib/two_captcha/errors.rb