Class: Nx::GatherProxy
- Inherits:
-
Object
- Object
- Nx::GatherProxy
- Defined in:
- lib/nx/version.rb,
lib/nx/gather-proxy.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Class Method Details
.fetch ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nx/gather-proxy.rb', line 6 def self.fetch re_port = /"PROXY_PORT":"(.*?)"/ re_ip = /"PROXY_IP":"(.*?)"/ doc = Nokogiri::HTML( open( "https://proxygather.com/proxylist/country?c=China", read_timeout: 5, ) ) # process html use selector rows = doc.css("#tblproxy script") data = [] rows.each do |row| str = row.text port = re_port.match(str)[1].to_i(16) ip = re_ip.match(str)[1].to_s data << { ip: ip, port: port } end return data end |