Content Normalization

Universal Feed Parser can parse many different types of feeds: Atom, CDF, and nine different versions of RSS. You should not be forced to learn the differences between these formats. Universal Feed Parser does its best to ensure that you can treat all feeds the same way, regardless of format or version.

You can access the basic elements of an Atom feed using RSS terminology.

Accessing an Atom feed as an RSS feed

>>> import feedparser
>>> d = feedparser.parse('')
>>> d['channel']['title']
'Sample Feed'
>>> d['channel']['link']
>>> d['channel']['description']
'For documentation <em>only</em>
>>> len(d['items'])
>>> e = d['items'][0]
>>> e['title']
'First entry title'
>>> e['link']
>>> e['description']
'Watch out for nasty tricks'
>>> e['author']
'Mark Pilgrim ('

The same thing works in reverse: you can access RSS feeds as if they were Atom feeds.

Accessing an RSS feed as an Atom feed

>>> import feedparser
>>> d = feedparser.parse('')
>>> d.feed.subtitle_detail
{'type': 'text/html',
'base': '',
'language': None,
'value': 'For documentation <em>only</em>'}
>>> len(d.entries)
>>> e = d.entries[0]
>>> e.links
[{'rel': 'alternate',
'type': 'text/html',
'href': ''}]
>>> e.summary_detail
{'type': 'text/html',
'base': '',
'language': 'en',
'value': 'Watch out for <span>nasty tricks</span>'}
>>> e.updated_parsed
(2002, 9, 5, 0, 0, 1, 3, 248, 0)


For more examples of how Universal Feed Parser normalizes content from different formats, see Annotated Examples.