Thursday, February 11, 2010

Finding CNN's Feed

I'm new to RSS. I just learned
how to find CNN's feed by going
to their homepage.

Here are the general steps:

  1. Go to www.cnn.com
  2. View the source HTML
  3. Look for the link tag
  4. Find the link tags that
    say the following:

type="application/rss+xml"

Ok. That's pretty general. Let's
get more specific.

It turns out that CNN's home
page has link tags representing
two RSS feeds. Here are the two
feeds as described by CNN:

  1. CNN - Top Stories [RSS]
  2. CNN - Recent Stories [RSS]

So, in other words, CNN has two
feeds. One is for top stories
and the other is for recent stories.

Must be that one feed has stories
that are currently dominating the
news and the other has stories
that were recently dominating the
news. Something like that.

Here's specifically how I found
out about these two feeds. I
took the following steps:

  1. Go to www.cnn.com
  2. Right click
  3. A menu appears
  4. Choose View Source
  5. Type Control-F
  6. A search box appears
  7. Search for link
  8. Hit F-3 (search again) until
    you find the first link tag that
    says rel="alternate".
  9. You just found the first feed
  10. Hit F-3 (search again) until
    you find the second link tag that
    says rel="alternate".
  11. You just found the second
    feed.

Here's what an empty (and rather
useless) link tag looks like:

<link>

An empty link tag is not at all
realistic. Link tags always
have attributes inside of them.

Here's what the link tags we
are searching for look like when
we include only the first
attribute:

<link rel="alternate"

The above is not really a link tag.
It is the beginning fragment of a
link tag. Link tags always end with
a > character (greater-than
character)
.

One more thing. Both of CNN's feeds
are RSS 2.0 feeds. This attribute
inside the link tag tells us this is true:

type="application/rss+xml

If CNN were to offer an Atom
Feed
as well, the type
atrribute
would look like
this:

type="application/atom+xml

Note that CNN offers RSS
feeds only
. At the time
of this writing, CNN does not
offer
an Atom Feed.

Oh, I almost forgot. There's one
more thing to look for inside
of the link tag. That's
the feed address.

Here's the attribute you look
for when you want to find where
the feed is kept:

href="feed.xml"

Of course, the name of the feed
is not likely to be feed.xml.

However, I think you get the idea.
The feed is an XML document
located at some URL.

Enough for now.

Ed Abbott

No comments:

Post a Comment