Created
February 16, 2010 09:09
-
-
Save pete-otaqui/305402 to your computer and use it in GitHub Desktop.
Prototype spider which uses 'bbc_standards' to test a whole website
This file contains hidden or 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
# Prototype spider which uses 'bbc_standards' to test a whole website | |
require 'rubygems' | |
require 'anemone' | |
require 'bbc_standards' | |
require 'term/ansicolor' | |
class String | |
include Term::ANSIColor | |
end | |
Anemone.crawl("http://pal.sandbox.dev.bbc.co.uk/") do |anemone| | |
anemone.on_every_page do |page| | |
begin | |
validator = BBCStandards::Validator.new(page.body) | |
if ( validator.errors.size > 0 ) then | |
puts "#{page.url} - #{validator.errors.size} errors found!".red | |
validator.errors.each do |error| | |
puts " * #{error.message}".red.bold | |
end | |
else | |
puts page.url.green | |
end | |
rescue | |
puts "#{page.url} - Failed to get page".yellow | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment