Module: Proxynova
- Defined in:
- lib/proxynova.rb,
lib/proxynova/version.rb
Constant Summary collapse
- BASE_URL =
'http://www.proxynova.com/proxy-server-list/country-'- DEFAULT_COUNTRY =
'US'- DEFAULT_URL =
BASE_URL+DEFAULT_COUNTRY.downcase
- VERSION =
"1.0.1"
Class Method Summary collapse
-
.get_list(country = DEFAULT_COUNTRY) ⇒ Object
Default Proxy IP List country is US This is simply an appending of the URL based on the currently url structure of proxynova.com.
- .print ⇒ Object
Class Method Details
.get_list(country = DEFAULT_COUNTRY) ⇒ Object
Default Proxy IP List country is US This is simply an appending of the URL based on the currently url structure of proxynova.com
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/proxynova.rb', line 12 def self.get_list(country = DEFAULT_COUNTRY) proxies = [] base_url = country.nil? ? DEFAULT_URL : BASE_URL+country.downcase page = Nokogiri::HTML(open(base_url)) proxy_table = page.search('#tbl_proxy_list tr') proxy_table.each do |row| data = row.search('td') if data.count >= 7 proxies << { ip: clean(data[0].text.strip), port: clean(data[1].text.strip), last_check: clean(data[2].search('.timeago').attr('datetime').text.strip), speed: data[3].search('.progress-bar').attr('data-value').text.strip.to_f.round(2), uptime: clean(data[4].text.strip), country: clean(data[5].text.strip), anonymity: clean(data[6].text.strip) } end end proxies end |
.print ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/proxynova.rb', line 34 def self.print proxies = get_list puts "IP ADDRESS\tPORT\tSPEED\tUPTIME\tLAST CHECK\t\tANONYMITY\tLOCATION" proxies.each do |proxy| puts "#{proxy[:ip]}\t#{proxy[:port]}\t#{proxy[:speed]}\t#{proxy[:uptime]}\t#{proxy[:last_check]}\t#{proxy[:anonymity]}\t#{proxy[:country]}" end end |