Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Created March 2, 2011 12:21
Show Gist options
  • Save henriquegogo/850847 to your computer and use it in GitHub Desktop.
Save henriquegogo/850847 to your computer and use it in GitHub Desktop.
Parser em Ruby usando o Nokogiri
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