Created
May 14, 2012 02:19
-
-
Save Davidslv/2691361 to your computer and use it in GitHub Desktop.
[Ruby + Nokogiri] Resultados do Euromilhões/Totoloto/Joker
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
# 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