Module: ProxyPool
- Defined in:
- lib/proxy_pool.rb,
lib/proxy_pool/dealer.rb,
lib/proxy_pool/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.3.0'
Class Method Summary collapse
-
.get(&block) ⇒ Hash
Get a proxy from proxy pool.
-
.get_by_country(cn) ⇒ Hash
Get proxy by country.
-
.get_high_anonymous_proxy ⇒ Hash
Get high anonymous proxy.
-
.get_http_proxy ⇒ Hash
Get http proxy.
-
.get_https_proxy ⇒ Hash
Get https proxy.
-
.remove(proxy) ⇒ nil
Remove this proxy from pool.
-
.update ⇒ Object
Update proxy pool.
Class Method Details
.get(&block) ⇒ Hash
Get a proxy from proxy pool
25 26 27 |
# File 'lib/proxy_pool.rb', line 25 def get(&block) ProxyPool::Dealer.instance.get(&block) end |
.get_by_country(cn) ⇒ Hash
Get proxy by country
40 41 42 |
# File 'lib/proxy_pool.rb', line 40 def get_by_country(cn) get { |proxy| proxy['country'].downcase == cn.downcase } end |
.get_high_anonymous_proxy ⇒ Hash
Get high anonymous proxy
32 33 34 |
# File 'lib/proxy_pool.rb', line 32 def get_high_anonymous_proxy get { |proxy| proxy['anonymity'] == 'high_anonymous' } end |
.get_http_proxy ⇒ Hash
Get http proxy
47 48 49 |
# File 'lib/proxy_pool.rb', line 47 def get_http_proxy get { |proxy| proxy['type'] == 'http' } end |
.get_https_proxy ⇒ Hash
Get https proxy
54 55 56 |
# File 'lib/proxy_pool.rb', line 54 def get_https_proxy get { |proxy| proxy['type'] == 'https' } end |