Last active
December 22, 2015 22:18
-
-
Save mru2/6538667 to your computer and use it in GitHub Desktop.
Simple ruby crawler for checking HTTP status codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'anemone' | |
require 'colorize' | |
entry = ARGV[0] | |
unless entry | |
puts "Please precise a point to start the crawl" | |
exit 1 | |
end | |
Anemone.crawl(entry) do |anemone| | |
anemone.on_every_page do |page| | |
out = "#{page.code} : #{page.url}" | |
case (page.code / 100) | |
when 2 | |
puts out.green | |
when 3 | |
puts out.yellow | |
else | |
puts out.red | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install :
Use :