kovidgoyal/html5-parser logo

kovidgoyal/html5-parser

Free

Fast C based HTML 5 parsing for python

FreeFree tier
Type
Open Source

About kovidgoyal/html5-parser

A fast, standards-compliant HTML5 parser for Python, written in C. It is over thirty times faster than pure Python parsers like html5lib. Based on the Google Gumbo parser, it provides correct parse trees according to the HTML5 specification. Ideal for web scraping and any Python application requiring efficient HTML parsing.

Key Features

C-based implementation for high performance
Over 30x faster than pure Python parsers like html5lib
Standards compliant with HTML5 specification
Based on Google Gumbo parser
Open source with Apache 2.0 license
Easy integration into Python applications

Pros & Cons

Pros
  • Extremely fast performance due to C backend
  • Standards compliant, producing correct parse trees
  • Open source with permissive Apache 2.0 license
  • Drop-in replacement for slower parsers like html5lib
Cons
  • Requires C compilation on installation, may not be as portable as pure Python
  • Limited to HTML5 parsing, not suitable for XML or other formats

Best For

Web scraping and data extractionHTML document parsing in Python applicationsBuilding tools that require fast, compliant HTML parsing

FAQ

How does html5-parser compare to html5lib?
html5-parser is over thirty times faster than html5lib and is based on the C-based Gumbo parser, while maintaining full HTML5 standards compliance.
What is the license?
html5-parser is open source under the Apache 2.0 license.