Skip to main content

Fast HTML5 CSS selector.

Project description

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

A fast HTML5 parser and CSS selectors using Modest engine.

  • Alpha version.

Installation

From PyPI using pip:

pip install selectolax

Development version from github:

git clone --recursive  https://github.com/rushter/selectolax
cd selectolax
pip -r requirements_dev.txt
python setup.py install

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.

Source Distribution

selectolax-0.1.6.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

selectolax-0.1.6-cp36-cp36m-win32.whl (457.7 kB view details)

Uploaded CPython 3.6mWindows x86

selectolax-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl (650.0 kB view details)

Uploaded CPython 3.6mmacOS 10.7+ x86-64

File details

Details for the file selectolax-0.1.6.tar.gz.

File metadata

  • Download URL: selectolax-0.1.6.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for selectolax-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a75edce56088dcd523c5789fcc36f8d5498c261d98704c4ac9d597d7de86e05d
MD5 48832855136ba059d8cbe15e434d7f7f
BLAKE2b-256 111b20677436625fb83638f30b0c976fc5e6af7fa7fc2cf6eb8e2c1638fbde39

See more details on using hashes here.

File details

Details for the file selectolax-0.1.6-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for selectolax-0.1.6-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 49c87632abe8c97e1a456871b51e3d6278f750d5fc9a7b562d970699eb9d04f7
MD5 ecd0da0ad7091a4ea1f556cb0d419f09
BLAKE2b-256 6a8c9ff1bcd10f28f7fee8e8a588d6bf80255a19a2e12ae051ee573a3e4ba857

See more details on using hashes here.

File details

Details for the file selectolax-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for selectolax-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 44929c5e13a7bde4f27d18c5130e6a83883c4360dc6cef7b1e8783c098f28efb
MD5 b73f446deab5ab45b7898b87294c1b9b
BLAKE2b-256 26bb3b6caf7cce5f42c956fab99edbc8d58810c1783257ce590fb6fbd5bf207e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page