Class: ProxyFetcher::Providers::XRoxy
- Inherits:
-
Base
- Object
- Base
- ProxyFetcher::Providers::XRoxy
show all
- Defined in:
- lib/proxy_fetcher/providers/xroxy.rb
Constant Summary
collapse
- PROVIDER_URL =
'http://www.xroxy.com/proxylist.php'.freeze
Instance Method Summary
collapse
Methods inherited from Base
#fetch_proxies!, fetch_proxies!
Instance Method Details
#load_proxy_list(filters = { type: 'All_http' }) ⇒ Object
6
7
8
9
|
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 6
def load_proxy_list(filters = { type: 'All_http' })
doc = load_document(PROVIDER_URL, filters)
doc.xpath('//div[@id="content"]/table[1]/tr[contains(@class, "row")]')
end
|
#to_proxy(html_element) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/proxy_fetcher/providers/xroxy.rb', line 11
def to_proxy(html_element)
ProxyFetcher::Proxy.new.tap do |proxy|
proxy.addr = parse_element(html_element, 'td[2]')
proxy.port = convert_to_int(parse_element(html_element, 'td[3]'))
proxy.anonymity = parse_element(html_element, 'td[4]')
proxy.country = parse_element(html_element, 'td[6]')
proxy.response_time = convert_to_int(parse_element(html_element, 'td[7]'))
proxy.type = parse_type(html_element)
end
end
|