html-wrapper

HTML parser with an lxml backend. Implements a subset of BeautifulSoup API and is an order of magnitude faster


Keywords
html, parser, wrapper, beautifulsoup, bs4, lxml, xml, fast, xpath, beautifulsoup-api, html-wrapper, python3
License
AGPL-3.0
Install
pip install html-wrapper==0.3.3

Documentation

html_wrapper

html_wrapper implements a small subset of the BeautifulSoup4 API. It can be anywhere from 10x-100x faster than bs4 for some use cases.

Installation

python3 -m pip install html_wrapper

Example

It's faster to instantiate and parse HTML. Suits my needs.

In [1]: from html_wrapper import HtmlWrapper

In [2]: from bs4 import BeautifulSoup

In [3]: from requests import get

In [4]: html: bytes = get("https://en.wikipedia.org/wiki/HTML").content

In [5]: %timeit HtmlWrapper(html).text
23.4 ms ± 563 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [6]: %timeit BeautifulSoup(html).text
190 ms ± 29.3 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

License

See LICENSE