Getting Detailed Information on Atom Elements

Several Atom elements share the Atom content model: title, tagline, info, copyright, summary, and of course content. Universal Feed Parser captures all relevant metadata about these elements, most importantly the content type and the value.

Example: Detailed Information on Feed Elements

>>> import feedparser
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom.xml')
>>> d.feed.title_detail
{'type': u'text/plain',
 'mode': u'escaped',
 'base': u'http://example.org/',
 'language': u'en',
 'value': u'Sample Feed'}
>>> d.feed.tagline_detail
{'type': u'text/html',
 'mode': u'escaped',
 'base': u'http://example.org/',
 'language': u'en',
 'value': u'For documentation <em>only</em>'}
>>> d.feed.info_detail
{'type': u'application/xhtml+xml', 
 'mode': u'xml',
 'base': u'http://example.org/', 
 'language': u'en',
 'value': u'<div><p>This is an Atom syndication feed.</p></div>'}
>>> d.feed.copyright_detail
{'type': u'text/html',
 'mode': u'escaped',
 'base': u'http://example.org/',
 'language': u'en',
 'value': u'<p>Copyright 2004, Mark Pilgrim</p>'}
>>> d.entries[0].title_detail
{'type': 'text/plain',
 'mode': 'escaped',
 'base': u'http://example.org/',
 'language': u'en',
 'value': u'First entry title'}
>>> d.entries[0].summary_detail
{'type': u'text/plain',
 'mode': u'escaped',
 'base': u'http://example.org/',
 'language': u'en',
 'value': u'Watch out for nasty tricks'}
>>> len(d.entries[0].content)
1
>>> d.entries[0].content[0]
{'type': u'application/xhtml+xml',
 'mode': u'xml',
 'base': u'http://example.org/entry/3',
 'language': u'en-US'
 'value': u'<div>Watch out for <span>nasty tricks</span></div>'}
← Common Atom Elements
Uncommon RSS Elements →