class ProxySeeker::Scrapers::ProxyListenScraper
Constants
- URL
Attributes
agent[R]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/proxy_seeker/scrapers/proxy_listen_scraper.rb, line 8 def initialize(opts = {}) @agent = Mechanize.new end
Public Instance Methods
fetch()
click to toggle source
# File lib/proxy_seeker/scrapers/proxy_listen_scraper.rb, line 12 def fetch agent = Mechanize.new page = agent.post(URL, { liststyle: 'leech', proxies: 300, submit: 'Show', type: 'http' }) key = page.forms.first.fields.first.name value = page.forms.first.fields.first.value page = agent.post(URL, { liststyle: 'leech', proxies: 300, submit: 'Show', type: 'http', "#{key}" => value }) list = page.parser.css('a.proxyList') list.map{ |x| ip, port = x.text.split(':'); ::ProxySeeker::Proxy.new(ip, port) } rescue [] end