Skip to main content

Fast HTML5 CSS selector.

Project description

A fast HTML5 parser and CSS selectors using Modest engine.

  • Alpha version.


From PyPI using pip:

pip install selectolax

Development version from github:

git clone --recursive
cd selectolax
pip -r requirements_dev.txt
python install


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)

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


Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
selectolax-0.1.8-cp36-cp36m-macosx_10_7_x86_64.whl (663.3 kB) Copy SHA256 hash SHA256 Wheel 3.6
selectolax-0.1.8.tar.gz (1.3 MB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page