Class: ProxyFetcher::Providers::HTTPTunnel

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

Overview

HTTPTunnel 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/http_tunnel.rb', line 8

def provider_url
  "http://www.httptunnel.ge/ProxyListForFree.aspx"
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
35
# File 'lib/proxy_fetcher/providers/http_tunnel.rb', line 25

def to_proxy(html_node)
  ProxyFetcher::Proxy.new.tap do |proxy|
    uri = parse_proxy_uri(html_node)
    proxy.addr = uri.host
    proxy.port = uri.port

    proxy.country = parse_country(html_node)
    proxy.anonymity = parse_anonymity(html_node)
    proxy.type = ProxyFetcher::Proxy::HTTP
  end
end

#xpathObject



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

def xpath
  '//table[contains(@id, "GridView")]/tr[(count(td)>2)]'
end