Created
August 24, 2012 09:55
-
-
Save jasonmadigan/3448470 to your computer and use it in GitHub Desktop.
404 Finder - Simple Ruby site crawler, finds 404s
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 | |
# Simple 404 finder | |
require 'rubygems' | |
require 'anemone' | |
url = ARGV[0] | |
if url.nil? | |
puts "Usage: 404_finder.rb http://example.com" | |
exit | |
end | |
Anemone.crawl(url) do |anemone| | |
anemone.on_every_page do |page| | |
if !page.code.nil? and page.code > 302 and !page.url.to_s.include?('%23') | |
puts "[#{page.code}] #{page.url} - Referrer: #{page.referer}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment