proxy_list 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.travis.yml +10 -1
- data/Gemfile +1 -0
- data/README.md +16 -3
- data/lib/proxy_list.rb +5 -0
- data/lib/proxy_list/site_cybersyndrome.rb +11 -7
- data/lib/proxy_list/site_freeproxylists.rb +2 -0
- data/lib/proxy_list/site_spys.rb +15 -11
- data/lib/proxy_list/version.rb +1 -1
- data/proxy_list.gemspec +2 -0
- data/spec/proxy_list_spec.rb +16 -0
- data/spec/spec_helper.rb +2 -3
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85bfdd544c66b2e0982a0b91b68b99485fbf8a7f
|
4
|
+
data.tar.gz: c9fb305fca79235196a29f52da1ff8afa6a02da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30d4e20af049309ee2ae65c8c7f16c07b90885418cd0933cb945ec967d54aaae59bfa13efb134b7284ce07e41b70ef0e3eba02feaf9e4c27bba7968cda702ea6
|
7
|
+
data.tar.gz: 05dffee7013d08d43323143da3fdc21a153ca0ab868bd40c13f1afab52a6f8405d787cee028a6997f161fcb599d1fb0497cbd837256e0ad9c1b83b4537491931
|
data/.coveralls.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
# ProxyList
|
1
|
+
# ProxyList
|
2
|
+
[![Build Status](https://travis-ci.org/tatsu07/proxy_list.svg?branch=master)](https://travis-ci.org/tatsu07/proxy_list) [![Coverage Status](https://coveralls.io/repos/tatsu07/proxy_list/badge.svg)](https://coveralls.io/r/tatsu07/proxy_list)
|
2
3
|
|
3
|
-
|
4
|
+
Get Free Proxy List
|
5
|
+
|
6
|
+
## Environment
|
7
|
+
|
8
|
+
・[phantomjs](http://phantomjs.org/)
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -20,7 +25,15 @@ Or install it yourself as:
|
|
20
25
|
|
21
26
|
## Usage
|
22
27
|
|
23
|
-
|
28
|
+
The country of proxy you can get by specifying the ISO country code
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'proxy_list'
|
32
|
+
#default US free proxy
|
33
|
+
proxy_list = ProxyList.get_lists
|
34
|
+
#useage country code
|
35
|
+
proxy_list = ProxyList.get_lists('GB')
|
36
|
+
```
|
24
37
|
|
25
38
|
## Contributing
|
26
39
|
|
data/lib/proxy_list.rb
CHANGED
@@ -9,7 +9,9 @@ require 'proxy_list/site_freeproxylists'
|
|
9
9
|
require 'proxy_list/site_cybersyndrome'
|
10
10
|
require 'proxy_list/site_spys'
|
11
11
|
|
12
|
+
Capybara.current_driver = :poltergeist
|
12
13
|
Capybara.javascript_driver = :poltergeist
|
14
|
+
Capybara.run_server = false
|
13
15
|
Capybara.register_driver :poltergeist do |app|
|
14
16
|
Capybara::Poltergeist::Driver.new(app,{:js_errors => false,:timeout => 1000,
|
15
17
|
:debug => false,:inspector => false,
|
@@ -23,5 +25,8 @@ module ProxyList
|
|
23
25
|
# @params [String] country_code ISO two byte code
|
24
26
|
def self.get_lists(country_code='US')
|
25
27
|
proxy_lists = ProxyList::SiteFreeproxylists.new(country_code).proxy_lists
|
28
|
+
proxy_lists.concat(ProxyList::SiteSpys.new(country_code).proxy_lists)
|
29
|
+
proxy_lists.concat(ProxyList::SiteCybersyndrome.new(country_code).proxy_lists)
|
30
|
+
proxy_lists.uniq
|
26
31
|
end
|
27
32
|
end
|
@@ -1,25 +1,29 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
module ProxyList
|
3
3
|
class SiteCybersyndrome
|
4
|
-
|
4
|
+
@@url = "http://www.cybersyndrome.net/search.cgi?q=COUNTRY_CODE"
|
5
5
|
##
|
6
6
|
# initialize
|
7
7
|
# @params [String] country_code
|
8
8
|
def initialize(country_code)
|
9
|
-
|
9
|
+
@@url.gsub!(/COUNTRY_CODE/,country_code)
|
10
10
|
end
|
11
11
|
|
12
12
|
##
|
13
13
|
# get proxy lists
|
14
14
|
# @return [Array] proxy_lists
|
15
15
|
def proxy_lists
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
session = Capybara::Session.new(:poltergeist)
|
17
|
+
session.driver.headers = {'User-Agent' => USER_AGENTS.sample}
|
18
|
+
session.visit(@@url)
|
19
19
|
proxy_lists = []
|
20
|
-
|
21
|
-
|
20
|
+
session.all(:xpath,"id('div_result')/table//tr/td[2]").each do |node|
|
21
|
+
if !node.text.nil?
|
22
|
+
proxy_lists.push("http://#{node.text}")
|
23
|
+
end
|
22
24
|
end
|
25
|
+
Capybara.reset_sessions!
|
26
|
+
session.driver.quit
|
23
27
|
proxy_lists
|
24
28
|
end
|
25
29
|
end
|
data/lib/proxy_list/site_spys.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
module ProxyList
|
3
3
|
class SiteSpys
|
4
|
-
|
4
|
+
@@url = "http://spys.ru/free-proxy-list/COUNTRY_CODE/"
|
5
5
|
|
6
6
|
##
|
7
7
|
# initialize
|
8
8
|
# @params [String] country_code
|
9
9
|
def initialize(country_code)
|
10
|
-
|
10
|
+
@@url.gsub!(/COUNTRY_CODE/,country_code)
|
11
11
|
end
|
12
12
|
|
13
13
|
|
@@ -15,18 +15,22 @@ module ProxyList
|
|
15
15
|
# get proxy lists
|
16
16
|
# @return [Array] proxy_lists
|
17
17
|
def proxy_lists
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
session = Capybara::Session.new(:poltergeist)
|
19
|
+
session.driver.headers = {'User-Agent' => USER_AGENTS.sample}
|
20
|
+
session.visit(@@url)
|
21
21
|
proxy_lists = []
|
22
|
-
|
23
|
-
if node.
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
session.all(:xpath,"//table[2]//tr[4]/td/table//tr[position()>3]").each do |node|
|
23
|
+
if !node.text.nil? && node.has_xpath?('td[2]/font')
|
24
|
+
if node.find(:xpath,'td[2]/font').text.include?('HTTP')
|
25
|
+
http = 'http'
|
26
|
+
else
|
27
|
+
http = 'https'
|
28
|
+
end
|
29
|
+
proxy_lists.push("#{http}://#{node.find(:xpath,'td[1]/font[2]').text}")
|
27
30
|
end
|
28
|
-
proxy_lists.push("#{http}://#{node.xpath('td[1]/font[2]').text}")
|
29
31
|
end
|
32
|
+
Capybara.reset_sessions!
|
33
|
+
session.driver.quit
|
30
34
|
proxy_lists
|
31
35
|
end
|
32
36
|
end
|
data/lib/proxy_list/version.rb
CHANGED
data/proxy_list.gemspec
CHANGED
@@ -21,4 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "capybara",'~> 2.4.4'
|
25
|
+
spec.add_development_dependency 'poltergeist', '~> 1.5.1'
|
24
26
|
end
|
data/spec/proxy_list_spec.rb
CHANGED
@@ -8,5 +8,21 @@ describe ProxyList do
|
|
8
8
|
it 'get proxy list' do
|
9
9
|
puts ProxyList.get_lists
|
10
10
|
expect(ProxyList.get_lists.count).to be > 0
|
11
|
+
puts ProxyList.get_lists('GB')
|
12
|
+
expect(ProxyList.get_lists.count).to be > 0
|
13
|
+
puts ProxyList.get_lists('JP')
|
14
|
+
expect(ProxyList.get_lists.count).to be > 0
|
15
|
+
puts ProxyList.get_lists('KR')
|
16
|
+
expect(ProxyList.get_lists.count).to be > 0
|
17
|
+
# puts ProxyList.get_lists('TW')
|
18
|
+
# expect(ProxyList.get_lists.count).to be > 0
|
19
|
+
# puts ProxyList.get_lists('HK')
|
20
|
+
# expect(ProxyList.get_lists.count).to be > 0
|
21
|
+
# puts ProxyList.get_lists('CN')
|
22
|
+
# expect(ProxyList.get_lists.count).to be > 0
|
23
|
+
# puts ProxyList.get_lists('CA')
|
24
|
+
# expect(ProxyList.get_lists.count).to be > 0
|
25
|
+
# puts ProxyList.get_lists('FR')
|
26
|
+
# expect(ProxyList.get_lists.count).to be > 0
|
11
27
|
end
|
12
28
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxy_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tatsunori_nishikori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capybara
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.4
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: poltergeist
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.5.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.5.1
|
55
83
|
description: get free proxy list
|
56
84
|
email:
|
57
85
|
- tora.1986.tatsu@gmail.com
|
@@ -59,6 +87,7 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- ".coveralls.yml"
|
62
91
|
- ".gitignore"
|
63
92
|
- ".rspec"
|
64
93
|
- ".ruby-version"
|