Method: Wmap::Utils::UrlMagic#landing_location
- Defined in:
- lib/wmap/utils/url_magic.rb
#landing_location(depth = 5, url) ⇒ Object
Test the URL / Site and return the landing url location (recursive with the depth = 4 )
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/wmap/utils/url_magic.rb', line 406 def landing_location (depth=5, url) depth -= 1 return url if depth < 1 timeo = Max_http_timeout/1000.0 uri = URI.parse(url) code = response_code (url) if code >= 300 && code < 400 url = redirect_location (url) url = landing_location(depth,url) else return url end return url rescue Exception => ee puts "Exception on method #{__method__} on URL #{url}: #{ee}" if @verbose end |