Skip to content

Instantly share code, notes, and snippets.

@seaneshbaugh
Created August 28, 2012 13:27
Show Gist options
  • Save seaneshbaugh/3497954 to your computer and use it in GitHub Desktop.
Save seaneshbaugh/3497954 to your computer and use it in GitHub Desktop.
Homepath
require 'mechanize'
banned_words = ['cute', 'financing', 'foreclosure', 'huge', 'zoning']
listings = File.open('listings.txt').readlines
agent = Mechanize.new
listings.each do |listing|
search_page = agent.get("http://www.homepath.com/listing/search?q=#{listing.strip}")
listing_details = search_page.parser.css('#listing_details_container').text
banned_words.each do |banned_word|
if listing_details.match /#{banned_word}/i
puts "Found banned word: \"#{banned_word}\" in listing #{listing.strip}!"
puts
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment