Previous topic

libearth.parser — Parsing various RSS formats

Next topic

libearth.parser.autodiscovery — Autodiscovery

This Page

libearth.parser.atom — Atom parser

Parsing Atom feed. Atom specification is RFC 4287

libearth.parser.atom.XMLNS_ATOM = 'http://www.w3.org/2005/Atom'

(str) The XML namespace for Atom format.

libearth.parser.atom.XMLNS_XML = 'http://www.w3.org/XML/1998/namespace'

(str) The XML namespace for the predefined xml: prefix.

libearth.parser.atom.parse_atom(xml, feed_url, parse_entry=True)

Atom parser. It parses the Atom XML and returns the feed data as internal representation.

Parameters:
  • xml (str) – target atom xml to parse
  • feed_url (str) – the url used to retrieve the atom feed. it will be the base url when there are any relative urls without xml:base attribute
  • parse_entry – whether to parse inner items as well. it’s useful to ignore items when retrieve <source> in rss 2.0. True by default.
Returns:

a pair of (Feed, crawler hint)

Return type:

tuple

Fork me on GitHub