Skip to content

Instantly share code, notes, and snippets.

@gregorymostizky
Created March 2, 2011 13:39
Show Gist options
  • Save gregorymostizky/850942 to your computer and use it in GitHub Desktop.
Save gregorymostizky/850942 to your computer and use it in GitHub Desktop.
Simple web scraping in few lines of code
require 'hpricot'
require 'open-uri'
doc = open('http://www.articlesbase.com/investing-articles/tips-for-successful-private-placement-trading-4339216.html') {|f| Hpricot(f)}
doc.search("script").remove
doc.search("style").remove
puts doc.search("body").text
@gregorymostizky
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment