Wrangling Proxies with Ruby


I needed a list of free proxies, obviously the more the better. Though I didn’t take this as far as I could have, I automated it quickly enough to get a quick and dirty list. Ruby always makes things better.

First, I downloaded a list from https://geonode.com/free-proxy-list in JSON format.

Next, I whipped up this quick Ruby script to pull out what I needed:

require 'json'

file = File.open("Free_Proxy_List.json")
list = JSON.parse(file.read)

list.each do |i|
  puts "#{i['protocols'][0]}" + "\t" + "#{i['ip']}" + "\t" + "#{i['port']}"
end

This output a long list like:

socks4  36.91.203.231   5678
socks4  101.43.156.158  2080
socks4  201.149.108.226 239
...

That I could easily copy and paste into what I needed it for. Taking things farther, I’ll be extending the script to pull down a fresh list when run, parse it out as above, and then insert the list where I need it. That’s for another time.

Leave a comment