FastSoup
BeautifulSoup interface for lxml
Key features
FAST search in tree
FAST serialize to str
BeautifulSoup4 interface to interact with object:
Search: find, find_all, find_next, find_next_sibling
Text: get_text, string
Tag: name, get, clear, __getitem__, __str__, __repr__, append, new_tag, extract, replace_with
Install
pip install fast-soup==1.1.0
How to use
from fast_soup import FastSoup
content = ... # read some html content
soup = FastSoup(content)
# interact like BS4 object
result = soup.find('a', id='my_link')
# interact like lxml object
el = result.unwrap()
FAQ
Q: BS4 already implement lxml parser. Why i should use FastSoup?
A: Yes, BS4 implement parser, and it’s just building the tree. All next interactions proceed with “Python speed”: searching, serialization. FastSoup internally use lxml and guarantee “C speed”.
Q: How FastSoup speedup works?
A: FastSoup just build xpath and execute them. For prevent rebuilding LRU cache used.
Q: Why you don’t support whole interface? This will be soon?
A: I wrote functions which speed up parsing in my projects. Just create a issue or pull request and i think we find the solution ;)
Miscellaneous
You can got power of BeautifulSoup when wrap your lxml objects, e.g:
from fast_soup import Tag
content = ... # some bytes ready to parse
context = lxml.etree.iterparse(
io.BytesIO(content), ...
)
for event, elem in context:
tag = Tag(elem)
tag_text = tag.get_text()
tag_attr = tag['attribute']
Metadata
Release files for fast-soup 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fast-soup-1.1.0.tar.gz | 17.2 kB | Without provenance | Details for fast-soup-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fast_soup-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for fast_soup-1.1.0-py3-none-any.whl |
Total release size: 34.1 kB
Release files / fast-soup-1.1.0.tar.gz
| Download URL | fast-soup-1.1.0.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd5561ad632c80b1fedf1369dddf3ab36f588216507cb036122b58ea1098b25
|
|
BLAKE2b-256 checksum How to use checksums |
6e2bd79b13c8c9a0616fe7e6cbece71ea55d1ec2ed5a6f98a2239cd03dd8e2ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.3 Darwin/19.3.0
|
Release files / fast_soup-1.1.0-py3-none-any.whl
| Download URL | fast_soup-1.1.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
667727116d3a85edcb91fce60a023c5ae18e7ac9aff1c349d2bd938db9c2e539
|
|
BLAKE2b-256 checksum How to use checksums |
1173bb35af0264172a4ad5a374d00f294071e3b284829eb9a8f7c3e114672797
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.3 Darwin/19.3.0
|
Security for fast-soup 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.