Fast HTML5 CSS selector.
Project description
A fast HTML5 parser and CSS selectors using Modest engine.
Installation
From PyPI using pip:
pip install selectolax
Development version from github:
git clone --recursive https://github.com/rushter/selectolax
cd selectolax
pip install -r requirements_dev.txt
python setup.py install
How to compile selectolax while developing:
make clean
make dev
Examples
from selectolax.parser import HTMLParser
html = "<div><p id=p1><p id=p2><p id=p3><a>link</a><p id=p4><p id=p5>text<p id=p6></div>"
selector = "div > :nth-child(2n+1):not(:has(a))"
for node in HTMLParser(html).css(selector):
print(node.attributes, node.text(), node.tag)
print(node.parent.tag)
print(node.html)
Simple Benchmark
Average of 10 experiments to parse and retrieve URLs from 800 Google SERP pages.
Package |
Time |
Memory (peak) |
---|---|---|
selectolax |
2.38 sec. |
768.11 MB |
lxml |
18.67 sec. |
769.21 MB |
Links
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
selectolax-0.2.1.tar.gz
(1.3 MB
view hashes)
Built Distributions
selectolax-0.2.1-cp37-cp37m-win32.whl
(512.0 kB
view hashes)
selectolax-0.2.1-cp36-cp36m-win32.whl
(512.2 kB
view hashes)
selectolax-0.2.1-cp35-cp35m-win32.whl
(510.2 kB
view hashes)
Close
Hashes for selectolax-0.2.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18106b5fb9720fea3751b01a8ba781b50f1392fd913453e737e11372b5678003 |
|
MD5 | a282738221cb64aa2b52b224a6f20a7f |
|
BLAKE2b-256 | d3a151cf7c5162517590900f64f1836d75ddd8d127f8dcf2542902d3f5b048f7 |
Close
Hashes for selectolax-0.2.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c0064d3224fe893f6893b25388facecb44a47a96a424a18821bece33c837062 |
|
MD5 | cd2cab2461e4ef571ac97b741471d8fb |
|
BLAKE2b-256 | 5884d89b3d02c3b48bb816e4e0999bdf47c61c4edac41801e494346989a0f7bd |
Close
Hashes for selectolax-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73e8bcf5a157e70a7b00b41d2e03e06a52c62bbdf8a26c20f7616696110d683f |
|
MD5 | 5856849a57b93a495bec18e88e0dbdf7 |
|
BLAKE2b-256 | 5bfa026b752fbaa7272e3d50fbd95f7d3343ba372d61902d06ef2750571c8ca6 |
Close
Hashes for selectolax-0.2.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37f6dfe2e482734538da61250b77513e83a5719f47a01d0e2cbee7cd20187ad3 |
|
MD5 | f25eecd3b553455d2e56a66e036ad1d7 |
|
BLAKE2b-256 | ca2231e7aa83ef5f61b2426233cc9e9780317409631dd6fdd8b20fbecdefa7bc |
Close
Hashes for selectolax-0.2.1-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d417ea7ff949388fabd7cd7666de003061d7643379874265a97ece2ef6c7800b |
|
MD5 | d70d67775096dc2adcc446ee4a78bae9 |
|
BLAKE2b-256 | 2f3ad9527e0e0c8951f9af3680935c3e6294f328583708d52243715663482a58 |
Close
Hashes for selectolax-0.2.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 289c29e46db5d3d459fb94a8f43bd255d842f484c49a2663a0f21c192a5b0c80 |
|
MD5 | ada7924feef5896c9b864c9aae41ec42 |
|
BLAKE2b-256 | 279089bf2357658f945110ea0f2c79f15999f4dbb8b789b456c938d3803a8492 |
Close
Hashes for selectolax-0.2.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03b343b4773b405c4045db2755f12ba1d6d7eb7e8462f7cec6f79e882200f96e |
|
MD5 | 7fbaf786468d0265e61de56e2704dfd3 |
|
BLAKE2b-256 | 3ab22bd3bbe510482b775dbf361a49017fa85844b24ef0542ea88cca92d71d53 |
Close
Hashes for selectolax-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea6295ded43d851479d4b518e66f633314c54a7c0861f1359665b341a0156fb |
|
MD5 | ea4a708d48e48b234d537ffea2262ad2 |
|
BLAKE2b-256 | bee4abd456ffe57a34ae230dc9303916d00a864387447ea034aa5ace02d35ebe |
Close
Hashes for selectolax-0.2.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f892244c90d426ae8cbb07d2cac16b8981ca08997bcf54c7b7f8578d02a19043 |
|
MD5 | 25114c2e456ec40d42fd5498cdd4f393 |
|
BLAKE2b-256 | 80de1cd53bb780cb551d3a4ad9025ba7e4561de3ddc260943cf44d592e7be402 |
Close
Hashes for selectolax-0.2.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbd92c1deb48a4a6108fd0930a3996c89acb644ed4da354669ecc94aa2f47907 |
|
MD5 | b721dfe2cb474840310c7292b7f82dc6 |
|
BLAKE2b-256 | 7522779c42b5b610bcf32602421ffe539cfe3cbe7e0f4d11d530b738ebc41f29 |
Close
Hashes for selectolax-0.2.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47e9f943f82bfc3390df735a9d88700362019a213da5a256f4fce00d2179dd28 |
|
MD5 | 74a4bb71159050111df990a0c246755d |
|
BLAKE2b-256 | 5c3a4668df844322cfd668cbc4d8ac22f09eda0f64ca054a86193ae62957a775 |
Close
Hashes for selectolax-0.2.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1874f9ac53abdf092c99cae147ccc931aaf3497f25884ab82dbb122759ccb883 |
|
MD5 | a7141487e1dd80dc7f4fcd0ad27e3a5f |
|
BLAKE2b-256 | 3632c3665076dc0a650dc1131660bfc8f4eee23b4740d87e03c37fd9faf8620d |
Close
Hashes for selectolax-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4a8e75553d6d6d8bef3481e5698c87a43312bf745bda485446ed77133106b4d |
|
MD5 | 318692646e4a90178d4414db1b2d8609 |
|
BLAKE2b-256 | 7fe6baa3ee4571b39491e974928981dfad6cf7143dd6490acbd7d49975eb6bfb |
Close
Hashes for selectolax-0.2.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2540c25422960cdf469612738ce285d30324cf5a12cae23a503b0ee9ab4e01e6 |
|
MD5 | bacfc3ce99d0bb6a3c6729939d207a1d |
|
BLAKE2b-256 | ef91bcb5d186b200fb3800ddbaf147b4a0b90f22b24c391abd99e61fcb62d04c |
Close
Hashes for selectolax-0.2.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6016ca140447c118aa97413956fa418f7a24ea8a3435dc099d397ca214e9652 |
|
MD5 | 2cff92e7a4e8516a63350d190c5d3b43 |
|
BLAKE2b-256 | 3fc19a93d92622fedd2514650de48b2e9491114b77d5499e4f066ab67230f134 |