Skip to content

Instantly share code, notes, and snippets.

@marcheiligers
Created April 22, 2010 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcheiligers/374872 to your computer and use it in GitHub Desktop.
Save marcheiligers/374872 to your computer and use it in GitHub Desktop.
def perform(url, rules, file_name)
response = Net::HTTP.get_response(URI.parse(url))
doc = Hpricot(response.body)
file = File.open(file_name, "a")
rules.each do |rule|
(doc/rule).each do |element|
file.puts element.inner_html
end
end
file.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment