dompruner
English | 한국어
DOM AST middleware for LLM web pipelines — sits between raw HTML and your model, strips nav/ads/scripts via AST parsing, delivers original content token-efficient.
When an LLM agent fetches a web page, it receives tens of thousands of raw HTML tokens it doesn't need — navigation, ads, scripts, footers. dompruner strips all of that via DOM AST parsing and passes the original content, unchanged, directly to the model. No intermediate summarization model, no API key, no vector database.
> docs.python.org/3/library/asyncio-task.html (query: "create_task")
> Raw HTML 44,315 tokens
> dompruner 1,275 tokens (97.1% reduction, BM25 section filter applied)
Install
pip install dompruner
For JavaScript-rendered pages (optional):
pip install "dompruner[playwright]" && playwright install chromium
Usage
CLI
python -m dompruner https://docs.python.org/3/library/asyncio-task.html
python -m dompruner https://docs.python.org/3/library/asyncio-task.html "create_task"
python -m dompruner https://docs.python.org/3/library/asyncio-task.html --json
Python
import asyncio
from dompruner import run_pipeline
result = asyncio.run(run_pipeline(
"https://docs.python.org/3/library/asyncio-task.html",
query="create_task",
))
print(result.markdown)
print(f"{result.original_tokens:,} → {result.refined_tokens:,} tokens ({result.reduction_ratio:.1%})")
print(result.meta) # {'title': '...', 'lang': 'en', 'description': '...', ...}
LangChain
from dompruner.langchain import DomPrunerLoader
docs = DomPrunerLoader(
"https://fastapi.tiangolo.com/tutorial/body/",
query="request body",
).load()
# docs[0].metadata includes: source, render_type, reduction_ratio,
# bm25_confidence, cached, title, description, lang, author, ...
→ Full LangChain integration guide — Loader, BatchLoader, SitemapLoader, Retriever, Tool
How It Works
URL → fetch (httpx → UA rotation → Playwright) → render type detection
└─ SSG: __NEXT_DATA__ RSC tree walk → Markdown
└─ SSR/CSR: DOM AST pipeline
L1 FQN Router → L2 Heading Cluster → L3 CETD Engine
→ BM25+ Section Filter → Compact Markdown
Related
- dompruner-mcp — MCP server for Claude Code, Claude Desktop, Cursor, Windsurf. Zero install —
npx -y dompruner-mcp. - LangChain integrations — listed as a third-party web loader.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 dompruner-0.8.0.tar.gz.
File metadata
- Download URL: dompruner-0.8.0.tar.gz
- Upload date:
- Size: 42.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6783ac70be0e6160d222c85f7da0cac6b88fc1dce70d9e10482f4b55b627a4ea
|
|
| MD5 |
0e36535aec16439ac1b0a70ec6ebca91
|
|
| BLAKE2b-256 |
8655ac82d7511620eadb735b3f5f457b5686afc6146e478d82f09e1ef9a27cdf
|
Provenance
The following attestation bundles were made for dompruner-0.8.0.tar.gz:
Publisher:
publish.yml on dong7812/dompruner-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dompruner-0.8.0.tar.gz -
Subject digest:
6783ac70be0e6160d222c85f7da0cac6b88fc1dce70d9e10482f4b55b627a4ea - Sigstore transparency entry: 2433249438
- Sigstore integration time:
-
Permalink:
dong7812/dompruner-py@5feee36608c02fa179382cfea5c99dae76ce39d2 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/dong7812
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5feee36608c02fa179382cfea5c99dae76ce39d2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dompruner-0.8.0-py3-none-any.whl.
File metadata
- Download URL: dompruner-0.8.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c4a45e3d31597a196e3ccd2f9901017f11e8299b15d67bdfb822aaffda41d52
|
|
| MD5 |
9800e3ca7093ee35e1cea1bb23289160
|
|
| BLAKE2b-256 |
e55cfda1813f1b7d5279855e367c9d551f6863f5c53951bf52cfa50c4d93e0b4
|
Provenance
The following attestation bundles were made for dompruner-0.8.0-py3-none-any.whl:
Publisher:
publish.yml on dong7812/dompruner-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dompruner-0.8.0-py3-none-any.whl -
Subject digest:
3c4a45e3d31597a196e3ccd2f9901017f11e8299b15d67bdfb822aaffda41d52 - Sigstore transparency entry: 2433249679
- Sigstore integration time:
-
Permalink:
dong7812/dompruner-py@5feee36608c02fa179382cfea5c99dae76ce39d2 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/dong7812
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5feee36608c02fa179382cfea5c99dae76ce39d2 -
Trigger Event:
push
-
Statement type: