Class: ProxyFetcher::Providers::HTTPTunnel

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

Constant Summary collapse

PROVIDER_URL =
'http://www.httptunnel.ge/ProxyListForFree.aspx'.freeze

Instance Method Summary collapse

Methods inherited from Base

#fetch_proxies!, fetch_proxies!

Instance Method Details

#load_proxy_listObject



6
7
8
9
# File 'lib/proxy_fetcher/providers/http_tunnel.rb', line 6

def load_proxy_list(*)
  doc = load_document(PROVIDER_URL)
  doc.xpath('//table[contains(@id, "GridView")]/tr[(count(td)>2)]')
end

#to_proxy(html_element) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/proxy_fetcher/providers/http_tunnel.rb', line 11

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

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