Working with RSS Feeds
http://today.reuters.com/rss/topNews/ is an RSS (Really Simple Syndication) page listing the top Reuters news information in an XML format. There is some information at the top, then each news story begins with <item> and contains <link> information and sometimes an <image>.
Here's what the top of the page looks like right now:
<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel><title>Reuters: Top News</title>
<link>http://today.reuters.com/news<description>Reuters: Top News</description><image>
<item><title>U.S. troops kill 75 insurgents in Iraq offensive</title>
<link>http://today.reuters.com/news/newsarticle.aspx?type=topNews&storyid=2005-05-09T151659Z_01_N09668277_RTRIDST_0_NEWS-IRAQ-MONDAY-DC.XML</link><pubDate>Mon, 9 May 2005 15:18:06 GMT</pubDate>
<description> BAGHDAD (Reuters) - U.S. troops mounted an offensive in
Iraq's most rebellious province, killing 75 insurgents, but
rebels in Baghdad kept up car bombings on Monday designed to
undermine the new Iraqi government.</description></item>
<item><title>Bush has pride of place at Russian parade</title>
<link>http://today.reuters.com/news/newsarticle.aspx?type=topNews&storyid=2005-05-09T141336Z_01_L09397502_RTRIDST_0_NEWS-EUROPE-WAR-BUSH-DC.XML</link><pubDate>Mon, 9 May 2005 15:17:39 GMT</pubDate>
<description> MOSCOW (Reuters) - President Bush and Kremlin leader
Vladimir Putin put on their own show of bonhomie at Monday's
grand military parade on Red Square, setting aside political
strains as they smiled and chatted like old friends.</description></item>
You are to write a function (named "makeSummary") that will take a directory as input then:
- YOUR PROGRAM will visit http://today.reuters.com/rss/topNews/ and pick out the top FIVE news stories headlines.
- Generate a NEW HTML page named "personalNews.html" in the input directory that lists the top five headlines as <h1> headings and the descriptions of those news items as paragraphs. You must also include an <image> link to at least one image listed in the RSS news feed.
Links to this Page