Created
November 3, 2008 17:46
-
-
Save hchoroomi/21929 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 'atom' # sudo gem install atom | |
require 'net/http' | |
require 'uri' | |
feed_url = 'http://search.twitter.com/search.atom?q=meh' | |
begin | |
feed = Atom::Feed.new(Net::HTTP::get(URI::parse(feed_url))) | |
feed.entries.each do |entry| | |
puts "Title: #{entry.title}" | |
puts "Description: #{entry.content.value}" | |
puts "Link: #{entry.links.join(', ')}" | |
puts "Date: #{entry.published}" | |
puts '=' * 20 | |
end if feed | |
rescue Exception => ex | |
puts ex.message | |
end | |
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 'rss/1.0' | |
require 'rss/2.0' | |
require 'open-uri' | |
feed_url = 'http://search.twitter.com/search.rss?q=meh' | |
begin | |
content = "" # raw content of rss feed will be loaded here | |
open(feed_url) do |s| content = s.read end | |
rss = RSS::Parser.parse(content, false) | |
rss.items.each do |item| | |
puts "Title: #{item.title}" | |
puts "Description: #{item.description}" | |
puts "Link: #{item.link}" | |
puts "Date: #{item.date}" | |
puts '=' * 20 | |
end if rss | |
rescue Exception => ex | |
puts ex.message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment