Class: ProxyFetcher::Providers::XRoxy
- Defined in:
- lib/proxy_fetcher/providers/xroxy.rb
Overview
XRoxy provider class.
Instance Method Summary collapse
-
#provider_url ⇒ Object
Provider URL to fetch proxy list.
-
#to_proxy(html_node) ⇒ ProxyFetcher::Proxy
Converts HTML node (entry of N tags) to
ProxyFetcher::Proxy
object. - #xpath ⇒ Object
Methods inherited from Base
#fetch_proxies, fetch_proxies!, #provider_headers, #provider_method, #provider_params
Instance Method Details
#provider_url ⇒ Object
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.
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 |
#xpath ⇒ Object
12 13 14 |
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 12 def xpath "//tr[@class='row1' or @class='row0']" end |