Created
March 2, 2011 12:21
-
-
Save henriquegogo/850847 to your computer and use it in GitHub Desktop.
Parser em Ruby usando o Nokogiri
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 'nokogiri' | |
require 'open-uri' | |
click = Nokogiri::HTML(open('http://www.clickon.com.br/clickon-client-http-deal/Fortaleza')) | |
chuchu = Nokogiri::HTML(open('http://www.baratoprachuchu.com.br/')) | |
coletivo = Nokogiri::HTML(open('http://www.baratocoletivo.com.br/')) | |
puts 'Oferta do ClickOn: ' + click.css('.offer a')[0].content.strip() + ' Valor: ' + click.css('.price h2')[0].content.strip() | |
puts 'Oferta do Barato pra Chuchu: ' + chuchu.css('.tituloBanner h3')[0].content.strip() + ' Valor: R$' + chuchu.css('.comparacaoPrecos td:last')[0].content.strip() | |
puts 'Oferta do Barato Coletivo: ' + coletivo.css('#deal-intro h1')[0].content.strip() + ' Valor: ' +coletivo.css('#precocima p strong')[0].content.strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment