Mistři v programování na #hovnokod

Ruby #328

# search for position in google
   def search(request, keyword, p = nil)
      proxy = nil
   # init proxy
      if p # proxy object
         proxy = "http://#{p.proxy}/" # random proxy
         proxy_working = false 
         while not proxy_working
            begin
               timeout(5) { open(request, :proxy => proxy) }
            rescue Timeout::Error
               $log.put "bad broxy #{proxy}"
               proxy = "http://#{p.proxy}/"
               next
            rescue Errno::ECONNREFUSED
               $log.put "bad broxy #{proxy}"
               proxy = "http://#{p.proxy}/"
               next
            rescue OpenURI::HTTPError
               $log.put "bad broxy #{proxy}"
               proxy = "http://#{p.proxy}/"
               next
            else
               $log.put "working #{proxy}"
               proxy_working = true
            end
         end
      end
# code

HovnoKod,