An open API service indexing awesome lists of open source software.

https://github.com/alexdelorenzo/html_wrapper

HTML parser with lxml backend. Implements subset of BeautifulSoup API
https://github.com/alexdelorenzo/html_wrapper

beautifulsoup-api html html-wrapper python3

Last synced: 3 months ago
JSON representation

HTML parser with lxml backend. Implements subset of BeautifulSoup API

Awesome Lists containing this project

README

        

# 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.

```python3
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`