Class: ProxyFetcher::Providers::XRoxy

Inherits:
Base
  • Object
show all
Defined in:
lib/proxy_fetcher/providers/xroxy.rb

Overview

XRoxy provider class.

Instance Method Summary collapse

Methods inherited from Base

#fetch_proxies, fetch_proxies!, #provider_headers, #provider_method, #provider_params

Instance Method Details

#provider_urlObject

Provider URL to fetch proxy list



8
9
10
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 8

def provider_url
  "https://www.xroxy.com/proxylist.htm"
end

#to_proxy(html_node) ⇒ ProxyFetcher::Proxy

Converts HTML node (entry of N tags) to ProxyFetcher::Proxy object.

Parameters:

  • html_node (Object)

    HTML node from the ProxyFetcher::Document DOM model.

Returns:



25
26
27
28
29
30
31
32
33
34
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 25

def to_proxy(html_node)
  ProxyFetcher::Proxy.new.tap do |proxy|
    proxy.addr = html_node.content_at("td[1]")
    proxy.port = Integer(html_node.content_at("td[2]").gsub(/^0+/, ""))
    proxy.anonymity = html_node.content_at("td[3]")
    proxy.country = html_node.content_at("td[5]")
    proxy.response_time = Integer(html_node.content_at("td[6]"))
    proxy.type = html_node.content_at("td[3]")
  end
end

#xpathObject



12
13
14
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 12

def xpath
  "//tr[@class='row1' or @class='row0']"
end