Skip to main content

Fast HTML5 CSS selector.

Project description

https://img.shields.io/pypi/v/selectolax.svg

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

License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for selectolax, version 0.2.3
Filename, size File type Python version Upload date Hashes
Filename, size selectolax-0.2.3-cp35-cp35m-macosx_10_6_intel.whl (1.3 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-manylinux1_i686.whl (1.4 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-manylinux1_x86_64.whl (1.7 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-manylinux2010_i686.whl (1.4 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-manylinux2010_x86_64.whl (1.7 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-win32.whl (511.3 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp35-cp35m-win_amd64.whl (554.7 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-macosx_10_6_intel.whl (1.3 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-manylinux1_i686.whl (1.4 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-manylinux1_x86_64.whl (1.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-manylinux2010_i686.whl (1.4 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl (1.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-win32.whl (513.2 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp36-cp36m-win_amd64.whl (553.7 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-macosx_10_6_intel.whl (1.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-manylinux1_i686.whl (1.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-manylinux1_x86_64.whl (1.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-manylinux2010_i686.whl (1.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl (1.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-win32.whl (513.0 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp37-cp37m-win_amd64.whl (553.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size selectolax-0.2.3-cp38-cp38-manylinux1_i686.whl (1.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size selectolax-0.2.3-cp38-cp38-manylinux1_x86_64.whl (1.8 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size selectolax-0.2.3-cp38-cp38-manylinux2010_i686.whl (1.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size selectolax-0.2.3-cp38-cp38-manylinux2010_x86_64.whl (1.8 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size selectolax-0.2.3.tar.gz (1.3 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page