Skip to content

Instantly share code, notes, and snippets.

@tjboudreaux
Created March 6, 2010 07:07
Show Gist options
  • Save tjboudreaux/323560 to your computer and use it in GitHub Desktop.
Save tjboudreaux/323560 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'active_record'
require 'robots'
dbconfig = YAML::load(File.open("db.yml"))
ActiveRecord::Base.establish_connection(dbconfig)
ActiveRecord::Base.logger = Logger.new(STDERR)
class DomainName < ActiveRecord::Base
end
robots = Robots.new "Kfx2 Spider"
domains = DomainName.find(:all)
domains.each do |domain|
url = "http://"+domain.hostname
begin
if !robots.allowed?(url)
puts domain.hostname
end
rescue
print "An error occurred: ",$!, "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment