Class: ProxyFetcher::Providers::GatherProxy
- Defined in:
- lib/proxy_fetcher/providers/gather_proxy.rb
Overview
GatherProxy 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
10 11 12 |
# File 'lib/proxy_fetcher/providers/gather_proxy.rb', line 10 def provider_url "https://proxygather.com" end |
#to_proxy(html_node) ⇒ ProxyFetcher::Proxy
Converts HTML node (entry of N tags) to ProxyFetcher::Proxy
object.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/proxy_fetcher/providers/gather_proxy.rb', line 27 def to_proxy(html_node) json = parse_json(html_node) ProxyFetcher::Proxy.new.tap do |proxy| proxy.addr = json["PROXY_IP"] proxy.port = json["PROXY_PORT"].to_i(16) proxy.anonymity = json["PROXY_TYPE"] proxy.country = json["PROXY_COUNTRY"] proxy.response_time = json["PROXY_TIME"].to_i proxy.type = ProxyFetcher::Proxy::HTTP end end |
#xpath ⇒ Object
14 15 16 |
# File 'lib/proxy_fetcher/providers/gather_proxy.rb', line 14 def xpath '//div[@class="proxy-list"]/table/script' end |