Creating an RSS Mashup
In this assignment, you will learn how to mashup the information published on the Web as RSS feeds. Mashups are situational applications:
they are meant for specific, generally short lived, needs and thus have
to be put together rather quickly and easily.
RSS is a leading standard for publishing structured summaries of
information (syndication) over the Web. Example uses of RSS include
news headlines, blog posts, stock quotes, and weather information.
A popular way of creating mashups is to aggregate, manipulate, and
republish the information published as RSS feeds by various providers.
To see some simple mashups and examples of cool
mashups created by others, you may visit Yahoo pipes. However, in this assignment you will create your own mashup using tools provided by Project Zero.
UPDATES
Updates override other information specified on this page.
- HINT: 02-12-2010: Remember that you need to add dependency for the timer package as well; add the following to the ivy.xml <dependency name="zero.timer" org="zero" rev="[1.0.0.0,2.0.0.0["/>
- CORRECTION: 02-11-2010: Your financial_roundup.groovy file needs to be in the app/scripts folder for the timer package to work
- CLARIFICATION: 02-09-2010: Your feed must sort based on published date of each news item (entry). Here is a SAMPLE OUTPUT
- SAMPLE CODE: 02-07-2010: Here is a SAMPLE GROOVY FILE
- CLARIFICATION: 02-05-2010: At the point where you generate your rss file simply copy the entire entry (SyndEntry) from the 3 feeds over to your feed instead of copying each element.
- NEW SPECIFICATION: 02-05-2010: Your deliverable now includes another groovy script---formatted_display.groovy---that should read the rss file you generate (financial_roundup.rss) and display it as html.
What is our situation (specific need)?
Richard N. Buffett must keep up with the latest in financial news. He
likes to read CNN, The Wall Street Journal and US News. So he has
subscribed to the following feeds: CNN,WSJ and USN.
However, Richard does not like the fact that the news on the feeds is
not sorted by date so he wants to merge them and create a sorted feed
that shows the latest news item on top.
Part 1a: Read an RSS feed
Let us learn how to read an RSS feed.
Learning this part is essential for the final deliverables. We will use
the Rome APIs (built-in support in Project Zero) for reading and creating RSS feeds.
- Explore these Rome tutorials in general for the entire assignment. In particular, see this on how RSS feeds can be read.
- Create a new zero application called "[your unity id].project2.rss"
which you will use to read the 3 feeds and dump the
retrieved information.
- Go through this documentation on how to add RSS support to a blank Zero project.
- Following
the above tutorial, write a simple Groovy script
financial_roundup.groovy in your public folder to read the feeds.
Process the feeds, merge them, sort them in reverse chronological order
determined by the published date and store it in a data structure.
Iterate over your result and print it for testing purposes.
You can run the script simply by pointing your browser to the URL for this script.
- Within your script, access the various fields of the feed entries such as
title, link, description and published date
- At this point, you should feel comfortable with reading RSS feeds into your application.
Part 1b: Publishing an RSS feed
This part also is just a learning exercise but essential for the final deliverables.
- Go through this tutorial.
- Remove the iteration and printing part of the code that you
incorporated in your financial_roundup.groovy script during the first
part. Now create a feed based on your sorted data, and output it as a
file to your public folder.
- Note that when you create your own feed, you have to specify
the feedType. Let us use "rss_2.0" as the feed type in this assignment.
- At this point, you should feel comfortable with publishing your own RSS feeds.
Part 1b: Displaying an RSS feed
- Write another script, formatted_display.groovy that reads your feed--financial_roundup.rss--and displays it as html
Deliverables
- A README.txt file containing the project member's names,
unity id's, section numbers, and any special instructions for your
submission.
- The sMash application zip file that is generated when you
click the package icon next to your application the "My Applications"
page in appbuilder. It must include the following files:
- A Groovy script (financial_roundup.groovy)
that reads the feeds and
publishes a new RSS feed (public/financial_roundup.rss) with the most recent news appearing first. Make sure that your script reads CNN, WSJ and USN feeds every 15 minutes and publishes a new one. Note: we will generate the rss file you don't have to submit it
- A groovy script public/formatted_display.groovy that displays financial_roundup.rss as html
Testing and grading
We will run your project and fire browser requests to formatted_display.groovy.
We will watch the RSS output at public/financial_roundup.rss. We will check that the file
is consistent with our output.
Tips and tricks for solving the Richard N. Buffett situation
- You will have to use the zero.timers package instead of the
Java Timer API. If you choose this route you must use the
"/config/zso/immediateStart = true" option to auto-fire the timer. Recommended.
- Optionally, You can use the Java Timer API in your feed publisher scripts to fire them at regular intervals. Here
is a useful tutorial. To avoid MissingMethodExceptions, you may want to
put your TimerTask class in the java folder of your project and
schedule it from Groovy.
Please use the message board for most cases for special consideration direct questions to Prashant pckediya@ncsu.edu