cit 383: administrative scriptingslide #1 cit 383: administrative scripting rss
Post on 22-Dec-2015
238 views
TRANSCRIPT
CIT 383: Administrative Scripting Slide #1
CIT 383: Administrative Scripting
RSS
CIT 383: Administrative Scripting
Topics
1. Web Feeds
2. Aggregators
3. RSS
4. Atom
5. 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
Feeds vs E-mail
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.
CIT 383: Administrative Scripting
Aggregators
CIT 383: Administrative Scripting
Aggregators
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
CIT 383: Administrative Scripting
Web Feed Formats
Web feeds include both content and metadataContent: Title, link, full or summarized text
Metadata: Author, publication date
XML-data formatsAtom
RSS
CIT 383: Administrative Scripting
RSS Variants
RSS-DEV Working GroupRDF Site Summary 0.90 from Netscape
RDF Site Summary 1.0
Harvard’s Berkman CenterRich 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 Slide #15
References1. Michael Fitzgerald, Learning Ruby, O’Reilly,
2008.2. David Flanagan and Yukihiro Matsumoto, The
Ruby Programming Language, O’Reilly, 2008.3. Hal Fulton, The Ruby Way, 2nd edition, Addison-
Wesley, 2007.4. Robert C. Martin, Clean Code, Prentice Hall,
2008.5. Dave Thomas with Chad Fowler and Andy Hunt,
Programming Ruby, 2nd edition, Pragmatic Programmers, 2005.