150 likes | 165 Views
Learn about web feeds and how they provide users with frequently updated information like news, weather, and more. Explore different web feed formats and aggregators, and discover how to use Ruby to work with RSS and Atom feeds.
E N D
RSS CIT 383: Administrative Scripting CIT 383: Administrative Scripting
CIT 383: Administrative Scripting Topics • Web Feeds • Aggregators • RSS • Atom • Feeds in Ruby
CIT 383: Administrative Scripting Web Feeds A web feed is a data format used for providing users with frequently updated information, like weather, news, comments. • Content providers syndicate a web feed by providing it via a URL on their web site. • Readers subscribe to a web feed to get updates. • Software like RSS Bandit or Google Reader aggregate multiple web feeds in a single interface so user does not have to visit sites to check for updates manually.
CIT 383: Administrative Scripting What data is available via feeds? • Blogs • Blog comments • Tagged blog entries • Music • News • Pictures (from Flickr) • Social networking sites • Transport schedules (Google Transit) • Videos • Weather
CIT 383: Administrative Scripting Web Feeds User pulls content from provider. Provider doesn’t know user e-mail. Unsubscribe by configuring client. E-mail Provider pushes content to user. Provider has user e-mail address. Unsubscribe by contacting provider. Feeds vs E-mail
CIT 383: Administrative Scripting Aggregators
CIT 383: Administrative Scripting Browser Firefox (live bookmarks) Firefox Sage add-on IE 7 Opera Standalone Akregator BottomFeeder Liferea RSS Bandit Online AmphetaDesk Bloglines Fastladder Google Reader Indirect iGoogle MyYahoo sidebars Aggregators
CIT 383: Administrative Scripting Web Feed Formats Web feeds include both content and metadata Content: Title, link, full or summarized text Metadata: Author, publication date XML-data formats Atom RSS
CIT 383: Administrative Scripting RSS Variants RSS-DEV Working Group RDF Site Summary 0.90 from Netscape RDF Site Summary 1.0 Harvard’s Berkman Center Rich Site Summary 0.91 from Netscape Really Simple Syndication 2.0
CIT 383: Administrative Scripting RSS 1.0 Example
CIT 383: Administrative Scripting Atom Alternative to RSS, published as RFC 4287. Features: • Requires title, unique ID, and last updated time. • Payload container specifies content type • Plain text • Escaped or well-formed HTML • Base64-encoded binary data • Separate summary and content elements. • Standardizes feed autodiscovery.
CIT 383: Administrative Scripting Atom Example
CIT 383: Administrative Scripting Ruby Feeds RSS • Part of Ruby core library. • Parses and writes RSS. FeedTools • Available as a gem. • Parses Atom and RSS. • Can convert between Atom and RSS versions. Rails • Can write Atom and RSS feeds.
CIT 383: Administrative Scripting FeedTools require ‘feed_tools’ url = ‘http://www.pragprog.com/podcasts/feed.rss’ feed = FeedTools::Feed.open(url) feed.entries.each_with_index do |entry,i| puts “#{i} #{entry.title}” end
CIT 383: Administrative Scripting References • Michael Fitzgerald, Learning Ruby, O’Reilly, 2008. • David Flanagan and Yukihiro Matsumoto, The Ruby Programming Language, O’Reilly, 2008. • Hal Fulton, The Ruby Way, 2nd edition, Addison-Wesley, 2007. • Robert C. Martin, Clean Code, Prentice Hall, 2008. • Dave Thomas with Chad Fowler and Andy Hunt, Programming Ruby, 2nd edition, Pragmatic Programmers, 2005.