Proxy List Fetcher Using Ruby
Join the DZone community and get the full member experience.
Join For FreeProxy list fetcher using Ruby, it saves proxies inside proxy_list.txt file
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'digest/sha1'
file = File.new("proxy_list.txt", "w")
doc = Hpricot(open("http://www.proxy4free.com/page1.html"))
trs = (doc/"table tr.text")
trs.each do |tr|
ip = (tr/"td:nth(0)").first.inner_html
if ip.match(/^[\d\.]+$/)
port = (tr/"td:nth(1)").first.inner_html
file.puts "#{ip}:#{port}"
end
end
file.close
Opinions expressed by DZone contributors are their own.
Comments