Created
March 24, 2009 22:18
-
-
Save jimmybaker/84398 to your computer and use it in GitHub Desktop.
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 'rubygems' | |
require 'open-uri' | |
require 'scrapi' | |
require 'hpricot' | |
# url = "http://www.edgewise-media.com/sonmindv60mi.html" | |
# css_selector = "html>body>table:nth-of-type(2) tr>td:nth-of-type(3)>table:nth-of-type(2) tr>td>form>font>table tr:nth-of-type(2)>td:nth-of-type(2)>font:nth-of-type(1)" | |
url = "http://www.tapestockonline.com/son60minprem.html" | |
css_selector = "html>body>table:nth-of-type(2) tr>td:nth-of-type(3)>table tr>td>form>table tr:nth-of-type(5)>td>table tr>td>table tr:nth-of-type(2)>td>table tr>td:nth-of-type(2)" | |
# | |
# doc = Hpricot(open(url)) | |
scraper = Scraper.define do | |
process css_selector, :price=>:text | |
end | |
result = scraper.scrape(URI.parse(url)) | |
puts result.price[/[\d\.]+/] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment