Gather list of proxies from various sources, validate them and rotate them for use.
Add this line to your application's Gemfile:
gem 'proxy_list'
And then execute:
$ bundle
Or install it yourself as:
$ gem install proxy_list
# Initialize
manager = ProxyList::Manager.new
# Fetch list of proxies
manager.fetch
# Cleanup the proxy list
manager.validate
# Get first avaliable proxy, and rotate the list
manager.proxy
=> '0.0.0.0:8080'
manager.proxy
=> '1.1.1.1:8080'
manager.proxy
=> '2.2.2.2:8080'
# Get a random proxy from the list, good when you have concurrent process
# or do not need a straightly round robin access to the proxies
manager.random_proxy
=> '2.2.2.2:8080'
# return all available proxy servers
manager.proxies
=> ['0.0.0.0:8080', '1.1.1.1:8080', '2.2.2.2:8080']
# remove a proxy from list
manager.delete('0.0.0.0:8080')
=> '0.0.0.0:8080'
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
This gem is inspired by anonymous_proxymaster gem by Marian Mrózek.
MIT. See LICENSE.txt
.