Class: ProxyList::SiteCybersyndrome
- Inherits:
-
Object
- Object
- ProxyList::SiteCybersyndrome
- Defined in:
- lib/proxy_list/site_cybersyndrome.rb
Constant Summary collapse
- @@url =
"http://www.cybersyndrome.net/search.cgi?q=COUNTRY_CODE"
Instance Method Summary collapse
-
#initialize(country_code) ⇒ SiteCybersyndrome
constructor
initialize.
-
#proxy_lists ⇒ Array
get proxy lists.
Constructor Details
#initialize(country_code) ⇒ SiteCybersyndrome
initialize
8 9 10 |
# File 'lib/proxy_list/site_cybersyndrome.rb', line 8 def initialize(country_code) @@url.gsub!(/COUNTRY_CODE/,country_code) end |
Instance Method Details
#proxy_lists ⇒ Array
get proxy lists
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/proxy_list/site_cybersyndrome.rb', line 15 def proxy_lists session = ::Session.new(:poltergeist) session.driver.headers = {'User-Agent' => USER_AGENTS.sample} session.visit(@@url) proxy_lists = [] session.all(:xpath,"id('div_result')/table//tr/td[2]").each do |node| if !node.text.nil? proxy_lists.push("http://#{node.text}") end end .reset_sessions! session.driver.quit proxy_lists end |