Drive the Contextractor Node crawler/extractor from Python — clean main-content text in txt, markdown, json, or html.
Project description
contextractor
Crawl web pages and extract clean main-content text — txt, markdown, json,
or html — from Python. Built on rs-trafilatura
(extraction) and Crawlee + Playwright
(crawling).
This package is a thin, typed wrapper that drives the bundled Node engine — a self-contained Node runtime ships with the wheel, so no Node.js install is required.
Install
pip install contextractor
python -m contextractor install # one-time: download the Chromium browser
Platform wheels are published for macOS (arm64, x86_64), Linux (x86_64, aarch64; glibc ≥ 2.28), and Windows (x64). Requires Python 3.12+.
Quick start
Crawl one or more URLs and write extracted files plus a manifest.json index to
output_dir:
import contextractor
summary = contextractor.extract(
["https://example.com"],
save=["markdown-kvs"],
output_dir="./out",
)
print(summary.succeeded, "of", summary.total)
An async variant, aextract(), takes the same arguments. Partial failures do
not raise — they are reflected in summary.failed; validation and real crawl
failures raise ContextractorError, and a missing browser raises
MissingBrowserError pointing you at python -m contextractor install.
Single-page extraction
extract_one() crawls exactly one URL (no link-following) and returns the
extracted content directly — nothing is written to disk:
import contextractor
markdown = contextractor.extract_one("https://example.com") # -> str
contents = contextractor.extract_one( # -> dict[str, str]
"https://example.com",
formats=["markdown", "json", "original"],
)
With one requested format the return value is a str; with several it is a
dict[str, str]. aextract_one() is the async variant.
Options
Every crawl option is a typed keyword argument, surfaced to editors and type
checkers via the ExtractOptions / ExtractOneOptions TypedDicts (e.g.
save, mode, proxy, cookies, headers, max_crawl_depth, globs). For
the full, authoritative option reference see the
project documentation and CLI help
(contextractor extract --help); the Python keywords map one-to-one onto the
CLI flags.
Only http, https, socks4, and socks5 proxy URLs are accepted; credentials
are never echoed in errors or logs. Set CONTEXTRACTOR_NODE_PATH to use a host
Node binary instead of the bundled runtime.
License
Apache-2.0
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextractor-0.4.5.tar.gz.
File metadata
- Download URL: contextractor-0.4.5.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
328d1098b17433ba3e188ce9735becd3f493d0fdc1adc717f71b4f367401934f
|
|
| MD5 |
010ddc3443696a93d80dd9da2a0a957d
|
|
| BLAKE2b-256 |
3b294d7032b972b83c1ef011b45cfb6bab081eaab66b0c1330411d7515e2e4a5
|
Provenance
The following attestation bundles were made for contextractor-0.4.5.tar.gz:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5.tar.gz -
Subject digest:
328d1098b17433ba3e188ce9735becd3f493d0fdc1adc717f71b4f367401934f - Sigstore transparency entry: 1850468487
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextractor-0.4.5-py3-none-win_amd64.whl.
File metadata
- Download URL: contextractor-0.4.5-py3-none-win_amd64.whl
- Upload date:
- Size: 29.2 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef5be54d4a8781ddc7021a9ce108942d8cea6ad37da86312c3ff4534b51044e9
|
|
| MD5 |
06518a0b0abd99c4d466bb6dde9e74a7
|
|
| BLAKE2b-256 |
1ea84ec1214a21bf4202594980633f3befe74e7813bdd473686f19d19f79ca10
|
Provenance
The following attestation bundles were made for contextractor-0.4.5-py3-none-win_amd64.whl:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5-py3-none-win_amd64.whl -
Subject digest:
ef5be54d4a8781ddc7021a9ce108942d8cea6ad37da86312c3ff4534b51044e9 - Sigstore transparency entry: 1850469589
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextractor-0.4.5-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: contextractor-0.4.5-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 29.3 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92ee861c035af1004fc1942542c84e4d9b6f06087e5ba0e57631a60971e2d382
|
|
| MD5 |
f61a1e6c063d669d2dccec4b79318750
|
|
| BLAKE2b-256 |
d2c75d3247ef5345c2a2c44e92ae2357caebf49813d19374643054e85527ff0a
|
Provenance
The following attestation bundles were made for contextractor-0.4.5-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
92ee861c035af1004fc1942542c84e4d9b6f06087e5ba0e57631a60971e2d382 - Sigstore transparency entry: 1850468642
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextractor-0.4.5-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: contextractor-0.4.5-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 29.2 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dd0ea815912a376b3838f3f9612fed0cae78092353b5b4b4c272b6f958308e8
|
|
| MD5 |
9fe7e213e7d5813d90455f37377298e6
|
|
| BLAKE2b-256 |
3cef686d1937ef7a016def2198086271bdc20bbd5d04a6254ac15f5584e9503e
|
Provenance
The following attestation bundles were made for contextractor-0.4.5-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
8dd0ea815912a376b3838f3f9612fed0cae78092353b5b4b4c272b6f958308e8 - Sigstore transparency entry: 1850469720
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextractor-0.4.5-py3-none-macosx_13_0_x86_64.whl.
File metadata
- Download URL: contextractor-0.4.5-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 29.2 MB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d72c7fb32348ff15a7dd82ea536dd08dceda573992445159c33c63d70617d768
|
|
| MD5 |
de41121c845abcd56ecb6eab824ec2c5
|
|
| BLAKE2b-256 |
617e341a5e663462ca4a51bb20f973e72c3cb500e4adbc58ab7982bb7ba39d5a
|
Provenance
The following attestation bundles were made for contextractor-0.4.5-py3-none-macosx_13_0_x86_64.whl:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5-py3-none-macosx_13_0_x86_64.whl -
Subject digest:
d72c7fb32348ff15a7dd82ea536dd08dceda573992445159c33c63d70617d768 - Sigstore transparency entry: 1850469032
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextractor-0.4.5-py3-none-macosx_13_0_arm64.whl.
File metadata
- Download URL: contextractor-0.4.5-py3-none-macosx_13_0_arm64.whl
- Upload date:
- Size: 29.1 MB
- Tags: Python 3, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a554126f06abc811bc804cd02e50a4bae211cbbfa037355415e338f4d1eab5f
|
|
| MD5 |
3006352928fa092c8d6ba3607f998924
|
|
| BLAKE2b-256 |
870a09b9cd1b1b848ee847f0b3aaf1a95f38b9d9134f4463d6d79f3a460328c7
|
Provenance
The following attestation bundles were made for contextractor-0.4.5-py3-none-macosx_13_0_arm64.whl:
Publisher:
release-pypi.yml on contextractor/contextractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextractor-0.4.5-py3-none-macosx_13_0_arm64.whl -
Subject digest:
9a554126f06abc811bc804cd02e50a4bae211cbbfa037355415e338f4d1eab5f - Sigstore transparency entry: 1850469196
- Sigstore integration time:
-
Permalink:
contextractor/contextractor@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/contextractor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fc44eef2e0a50557a0b2e9596b0ab515dbc5f93f -
Trigger Event:
workflow_dispatch
-
Statement type: