Skip to content

Instantly share code, notes, and snippets.

@Davidslv
Created May 14, 2012 02:19
Show Gist options
  • Save Davidslv/2691361 to your computer and use it in GitHub Desktop.
Save Davidslv/2691361 to your computer and use it in GitHub Desktop.
[Ruby + Nokogiri] Resultados do Euromilhões/Totoloto/Joker
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::XML(open('https://www.jogossantacasa.pt/web/SCRss/rssFeedCartRes'))
@items = doc.xpath('//item').map do |i|
{'title' => i.xpath('title').inner_text, 'description' => i.xpath('description').inner_text}
end
r = @items.first(3)
text = ''
r.each do |item|
desc = item['description'].split(':')
text << "#{item['title']} #{desc[1]} | "
end
p text + "http://twitter.com/davidslv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment