Module: HttpCrawler::Proxy::TestProxyApi::Response::GetProxy

Defined in:
lib/http_crawler/proxy/test_proxy_api/response/get_proxy.rb

Instance Method Summary collapse

Instance Method Details

#parsingObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/http_crawler/proxy/test_proxy_api/response/get_proxy.rb', line 7

def parsing
  array = []
  decoding_body.scan(/([^\n\r:]*):([^\n\r]*)/) do |v1, v2|
    if v1 =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
      array[array.length] = {"p_addr" => v1, "p_port" => v2, "p_user" => nil, "p_pass" => nil}
    else
      Rails.logger.warn decoding_body
    end
  end
  array
end