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('https://feedparser.readthedocs.io/en/expand-json-feed-support/examples/atom10.xml')
>>> d.version
'atom10'
>>> d = feedparser.parse('https://feedparser.readthedocs.io/en/expand-json-feed-support/examples/atom03.xml')
>>> d.version
'atom03'
>>> d = feedparser.parse('https://feedparser.readthedocs.io/en/expand-json-feed-support/examples/rss20.xml')
>>> d.version
'rss20'
>>> d = feedparser.parse('https://feedparser.readthedocs.io/en/expand-json-feed-support/examples/rss20dc.xml')
>>> d.version
'rss20'
>>> d = feedparser.parse('https://feedparser.readthedocs.io/en/expand-json-feed-support/examples/rss10.rdf')
>>> d.version
'rss10'
Here is the complete list of known feed types and versions that may be returned in version
:
rss090
rss091n
rss091u
rss10
rss092
rss093
rss094
RSS 0.94 (no accurate specification is known to exist)
rss20
rss
RSS (unknown or unrecognized version)
atom01
atom02
atom03
atom10
atom
Atom (unknown or unrecognized version)
cdf
json1
JSONFeed v1. In cases where no MIME type is available, JSON is assumed if the first non-whitespace character of the data is an opening brace
{
.json11
If the feed type is completely unknown, version
will be an empty string.