Created
March 2, 2011 13:39
-
-
Save gregorymostizky/850942 to your computer and use it in GitHub Desktop.
Simple web scraping in few lines of code
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple web scraping