Over a million developers have joined DZone.

Proxy List Fetcher Using Ruby

·
Proxy 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
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}