Feed Type and Version Detection¶
Universal Feed Parser attempts to autodetect the type and version of the feeds it parses. There are many subtle and not-so-subtle differences between the different versions of RSS, and applications may choose to handle different feed types in different ways.
Accessing feed version¶
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')
>>> d.version
'atom10'
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom03.xml')
>>> d.version
'atom03'
>>> d = feedparser.parse('http://feedparser.org/docs/examples/rss20.xml')
>>> d.version
'rss20'
>>> d = feedparser.parse('http://feedparser.org/docs/examples/rss20dc.xml')
>>> d.version
'rss20'
>>> d = feedparser.parse('http://feedparser.org/docs/examples/rss10.rdf')
>>> d.version
'rss10'
Here is the complete list of known feed types and versions that may be returned in version
:
rss090
- RSS 0.90
rss091n
- Netscape RSS 0.91
rss091u
- Userland RSS 0.91 (differences from Netscape RSS 0.91)
rss10
- RSS 1.0
rss092
- RSS 0.92
rss093
- RSS 0.93
rss094
- RSS 0.94 (no accurate specification is known to exist)
rss20
- RSS 2.0
rss
- RSS (unknown or unrecognized version)
atom01
- Atom 0.1
atom02
- Atom 0.2
atom03
- Atom 0.3
atom10
- Atom 1.0
atom
- Atom (unknown or unrecognized version)
cdf
- CDF
If the feed type is completely unknown, version
will be an empty string.