hidemyass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/hidemyass.rb +36 -3
- data/lib/hidemyass/version.rb +1 -1
- data/spec/lib/ip_spec.rb +1 -1
- metadata +17 -7
data/README.md
CHANGED
data/lib/hidemyass.rb
CHANGED
@@ -12,8 +12,7 @@ module HideMyAss
|
|
12
12
|
extend Logger
|
13
13
|
|
14
14
|
SITE = "http://hidemyass.com".freeze
|
15
|
-
|
16
|
-
ENDPOINT = "http://hidemyass.com/proxy-list/search-750598".freeze
|
15
|
+
ENDPOINT = "http://hidemyass.com/proxy-list/".freeze
|
17
16
|
|
18
17
|
LOG_PREFIX = '** [hidemyass] '
|
19
18
|
|
@@ -21,6 +20,7 @@ module HideMyAss
|
|
21
20
|
Errno::EINVAL,
|
22
21
|
Errno::ECONNRESET,
|
23
22
|
Errno::ECONNREFUSED,
|
23
|
+
Errno::ETIMEDOUT,
|
24
24
|
EOFError,
|
25
25
|
Net::HTTPBadResponse,
|
26
26
|
Net::HTTPHeaderSyntaxError,
|
@@ -36,7 +36,10 @@ module HideMyAss
|
|
36
36
|
|
37
37
|
def self.proxies
|
38
38
|
clear_cache if options[:clear_cache]
|
39
|
-
|
39
|
+
|
40
|
+
unless @proxies
|
41
|
+
html = get_hma_body
|
42
|
+
end
|
40
43
|
|
41
44
|
@proxies ||= html.xpath('//table[@id="listtable"]/tr').collect do |node|
|
42
45
|
ip = HideMyAss::IP.new(node.at_xpath('td[2]/span'))
|
@@ -51,4 +54,34 @@ module HideMyAss
|
|
51
54
|
def self.clear_cache
|
52
55
|
@proxies = nil
|
53
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def self.get_hma_body
|
61
|
+
data = {
|
62
|
+
"c[]" => ["United States"],
|
63
|
+
"p" => nil,
|
64
|
+
"pr[]" => [0,1,2],
|
65
|
+
"a[]" => [0,1,2,3],
|
66
|
+
"sp[]" => [2,3],
|
67
|
+
"ct[]" => [2,3],
|
68
|
+
"s" => 0,
|
69
|
+
"o" => 0,
|
70
|
+
"pp" => 2,
|
71
|
+
"sortBy" => "date"
|
72
|
+
}
|
73
|
+
|
74
|
+
res = Net::HTTP.post_form(URI(ENDPOINT), data)
|
75
|
+
|
76
|
+
body = case res
|
77
|
+
when Net::HTTPSuccess then
|
78
|
+
res.body
|
79
|
+
when Net::HTTPRedirection then
|
80
|
+
Net::HTTP.get_response(URI(SITE + res['location'])).body
|
81
|
+
else
|
82
|
+
res.value
|
83
|
+
end
|
84
|
+
|
85
|
+
return Nokogiri::HTML(body)
|
86
|
+
end
|
54
87
|
end
|
data/lib/hidemyass/version.rb
CHANGED
data/spec/lib/ip_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe HideMyAss::IP do
|
|
6
6
|
# but hidemyass.com seems to be changing their encoding strategy often.
|
7
7
|
# By having real data we ensure this gem is working.
|
8
8
|
it "decodes encoded address" do
|
9
|
-
html =
|
9
|
+
html = HideMyAss.get_hma_body
|
10
10
|
|
11
11
|
HideMyAss::IP.new(html.at_xpath('//table[@id="listtable"]/tr/td[2]/span'))
|
12
12
|
.should be_valid
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hidemyass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.5.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.5.5
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: 2.12.0
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.12.0
|
36
46
|
description: Hide My Ass! fetches and connects to proxies at www.hidemyass.com
|
37
47
|
email:
|
38
48
|
- javier@tractical.com
|
@@ -76,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
86
|
version: '0'
|
77
87
|
requirements: []
|
78
88
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.23
|
80
90
|
signing_key:
|
81
91
|
specification_version: 3
|
82
92
|
summary: Hide My Ass! lets you connect anonymously, fetch proxies from hidemyass.com
|