Skip to main content

selectolax-tree

Parse HTML into structured data using a YAML spec.

Powered by AimScrape.

中文文档:README-ZH.md

Versioned docs:

  • docs/0.1/USAGE.md (applies to 0.1.x)
  • Changelog: CHANGELOG.md

Dependencies

This tool is built on top of:

  • selectolax (HTML parsing + CSS selectors)
  • PyYAML (YAML spec parsing)

They are declared as install dependencies, so pip will install them automatically.

Install (recommended: venv)

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e ".[dev]"

Install via pip

From GitHub

python -m pip install "git+https://github.com/aimscrape/selectolax-tree.git"

From PyPI

python -m pip install selectolax-tree

YAML Spec (minimal)

fields:
  title:
    css: "h1"
    text: true

  link_hrefs:
    css: "a"
    list: true
    attr: "href"

  items:
    css: ".item"
    list: true
    fields:
      name: { css: ".name", text: true }
      url:  { css: "a", attr: "href" }

Python usage

from selectolax_tree import extract_from_yaml

data = extract_from_yaml(html, yaml_spec_str)

CLI

selectolax-tree --spec spec.yml --html-file page.html

Examples

Runnable scenario examples live in example/:

selectolax-tree --spec example/article/spec.yml --html-file example/article/page.html
selectolax-tree --spec example/product_list/spec.yml --html-file example/product_list/page.html
selectolax-tree --spec example/profiles/spec.yml --html-file example/profiles/page.html

Releasing (maintainers)

See RELEASING.md for PyPI publishing and GitHub Actions release automation.

Metadata

Release files for selectolax-tree 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for selectolax-tree 0.1.2
File Size Uploaded
selectolax_tree-0.1.2.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for selectolax-tree 0.1.2
File Interpreter ABI Platform
selectolax_tree-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / selectolax_tree-0.1.2.tar.gz

Download URL selectolax_tree-0.1.2.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5f0019cbb252bc6a9d4676de9a761900c37545562cc10b5c518f6ce98771a034
BLAKE2b-256 checksum
How to use checksums
0c8f8ead62d68fc9e86c1b34e9d9e2c9899ff41356ba8062c3c75e5700f7f507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 22, 2026.

Transparency log

Release files / selectolax_tree-0.1.2-py3-none-any.whl

Download URL selectolax_tree-0.1.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1475374cf19424c5f53416f443e769851a7610fe45e68a8291f0b07bea12b90
BLAKE2b-256 checksum
How to use checksums
c25362c4e55a7f7a4df6ba9487b9509266777d8021718d55f5848b7acd112906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page