def check_if_some_link_is_broken
@links.each_with_index do |link, index|
href = link['href']
if href != "" and href != nil
begin
if href.start_with? "javascript"
puts "(W) No deberia emplear javascript obstrusivo dentro del código HTML #{link}"
else
response = Curl.get href
# 302 es un redirect y 200 OK
if response.response_code != 200 or response.response_code != 302
puts "(W) Dirección no encontrada: #{link['href']}, status_code: #{response.response_code}".
end
end
rescue Exception => e
puts "Ha ocurrido un error: #{e.to_s}"
end
end
end
end