anti-captcha 0.0.3 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/anti-captcha/client.rb +9 -4
- data/lib/anti-captcha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff944e52dda52014a0bac8a4f499d67ee352fbe4
|
4
|
+
data.tar.gz: 69c8e9bd43533461dc5264332e6e601b93135ca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90abc4e586eaba6074a51d334ffcc0b8ada0c36664508c4427b44db874cfc0187d389a4c9772bb8cfe383373414df0350e63add4c2ae69a3bbe5db444b4df167
|
7
|
+
data.tar.gz: 1aa0d59ed0c144edb0e385cb43fb3b595bbe157aeb15731abdf3cd9c85709f70a2a719263071c96fd66bfc22a46e60a15ef0dfd5bff8d1e3f2586182237f5a8e
|
data/README.md
CHANGED
@@ -30,7 +30,18 @@ end
|
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
@client = AntiCaptcha::Client.new(retries_count: 5, phrase: 1)
|
33
|
-
code = @client.
|
33
|
+
code = @client.decode(image_content)
|
34
|
+
```
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
@client = AntiCaptcha::Client.new(retries_count: 5, phrase: 1)
|
38
|
+
code = @client.decode(image_content_base64, :base64)
|
39
|
+
```
|
40
|
+
|
41
|
+
## Upload to rubygems.org
|
42
|
+
|
43
|
+
```
|
44
|
+
gem release anti-captcha.gemspec
|
34
45
|
```
|
35
46
|
|
36
47
|
## Contributing
|
data/lib/anti-captcha/client.rb
CHANGED
@@ -11,8 +11,10 @@ module AntiCaptcha
|
|
11
11
|
@options = AntiCaptcha.configuration.options.merge(options)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# type: file data (bin)
|
15
|
+
# type: base64 (base64)
|
16
|
+
def decode(image, type = :bin)
|
17
|
+
case request_image(image, type)
|
16
18
|
when /OK\|(.+)/
|
17
19
|
@captcha_id = $1
|
18
20
|
check
|
@@ -70,9 +72,12 @@ module AntiCaptcha
|
|
70
72
|
id: @captcha_id
|
71
73
|
end
|
72
74
|
|
73
|
-
|
75
|
+
# type: file data (bin)
|
76
|
+
# type: base64 (base64)
|
77
|
+
def request_image(image, type = :bin)
|
78
|
+
body = (type == :bin ? Base64.encode64(image) : image)
|
74
79
|
request 'http://anti-captcha.com/in.php',
|
75
|
-
@options.merge(method: 'base64', body:
|
80
|
+
@options.merge(method: 'base64', body: body)
|
76
81
|
end
|
77
82
|
|
78
83
|
def request_report_bad
|
data/lib/anti-captcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anti-captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- debbbbie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|