Common :abbr:`RSS (Rich Site Summary)` Elements
===============================================
The most commonly used elements in :abbr:`RSS (Rich Site Summary)` feeds
(regardless of version) are title, link, description, publication date, and entry
ID. The publication date comes from the pubDate element, and the entry ID comes
from the guid element.
This sample :abbr:`RSS (Rich Site Summary)` feed is at
`$READTHEDOCS_CANONICAL_URL/examples/rss20.xml
<$READTHEDOCS_CANONICAL_URL/examples/rss20.xml>`_.
.. sourcecode:: xml
Sample FeedFor documentation <em>only</em>
http://example.org/
Sat, 07 Sep 2002 00:00:01 GMTFirst entry title
http://example.org/entry/3
Watch out for <span style="background-image:
url(javascript:window.location='http://example.org/')">nasty
tricks</span>Thu, 05 Sep 2002 00:00:01 GMThttp://example.org/entry/3
The channel elements are available in ``d.feed``.
Accessing Common Channel Elements
---------------------------------
.. code-block:: pycon
>>> import feedparser
>>> d = feedparser.parse('$READTHEDOCS_CANONICAL_URL/examples/rss20.xml')
>>> d.feed.title
'Sample Feed'
>>> d.feed.link
'http://example.org/'
>>> d.feed.description
'For documentation only'
>>> d.feed.published
'Sat, 07 Sep 2002 00:00:01 GMT'
>>> d.feed.published_parsed
(2002, 9, 7, 0, 0, 1, 5, 250, 0)
The items are available in ``d.entries``, which is a list. You access items in the list in the same order in which they appear in the original feed, so the first item is available in ``d.entries[0]``.
Accessing Common Item Elements
------------------------------
.. code-block:: pycon
>>> import feedparser
>>> d = feedparser.parse('$READTHEDOCS_CANONICAL_URL/examples/rss20.xml')
>>> d.entries[0].title
'First item title'
>>> d.entries[0].link
'http://example.org/item/1'
>>> d.entries[0].description
'Watch out for nasty tricks'
>>> d.entries[0].published
'Thu, 05 Sep 2002 00:00:01 GMT'
>>> d.entries[0].published_parsed
(2002, 9, 5, 0, 0, 1, 3, 248, 0)
>>> d.entries[0].id
'http://example.org/guid/1'
.. tip:: You can also access data from :abbr:`RSS (Rich Site Summary)` feeds using Atom terminology. See :ref:`advanced.normalization` for details.