Skip to content

feedparservshtml5lib

NOASSERTION 105 9 2,351
14.7 million (month) Jun 15 2007 6.0.12(2025-09-10 13:33:58 ago)
1,220 14 97 MIT
Jul 30 2007 32.8 million (month) 1.1(2020-06-22 23:32:36 ago)

feedparser is a Python module for downloading and parsing syndicated feeds. It can handle RSS 0.90, Netscape RSS 0.91, Userland RSS 0.91, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, Atom 1.0, and CDF feeds. It also parses several popular extension modules, including Dublin Core and Apple’s iTunes extensions.

To use Universal Feed Parser, you will need Python 3.6 or later. Universal Feed Parser is not meant to run standalone; it is a module for you to use as part of a larger Python program.

feedparser can be used to scrape data feeds as it can download them and parse the XML structured data.

html5lib is a pure-python library for parsing HTML. It is designed to conform to the WHATWG HTML specification, as is implemented by all major web browsers.

As html5lib is implemented in pure-python it is significantly slower than alternatives powered by lxml (like parsel or beautifulsoup). However, html5lib implements a more true html5 parsing which can represent HTML tree more correctly than alternatives.

Example Use


```python import feedparser # the feed can be loaded from a remote URL data = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') # local path data = feedparser.parse('/home/user/data.xml') # or raw string data = feedparser.parse('...') # the result dataset is a nested python dictionary containing feed data: data['feed']['title'] ```
```python import html5lib from html5lib import parse html_doc = "My Title" parsed = parse(html_doc) title = parsed.getElementsByTagName("title")[0] print(title.childNodes[0].nodeValue) ```

Alternatives / Similar


Was this page helpful?