Ruby Proxy Manager
Easy manage proxy in your parsers/web-bots.
Installation
Add this line to your application's Gemfile:
gem 'proxy_manager'
And then execute:
$ bundle
Or install it yourself as:
$ gem install proxy_manager
Usage
Load proxy list
From array (IP:PORT)
proxy = ProxyManager.load(['1.2.3.4:567', '9.8.7.6:543'])
or from file
proxy = ProxyManager.load('proxies.txt', 'bad_proxies.txt')
Files proxies.txt and bad_proxies.txt should be writable.
Example of proxies.txt content:
1.2.3.4:567
9.8.7.6:543
...
Get proxy
Get one proxy
proxy.get
# => ["1.2.3.4", 567]
Get many proxies
proxy.get(2)
# => [["1.2.3.4", 567], ["9.8.7.6", 543]]
Will be returning only pingable proxies
Proxies lists
You also can display list of loaded proxies
proxy.list
# => [["1.2.3.4", 567], ["9.8.7.6", 543]]
and list of bad proxies
proxy.bad_list
# => []
Documentation
http://rubydoc.info/gems/proxy_manager/frames
Contributing
- 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