Skip to main content

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

→ Architecture & internals


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

Release files for dompruner 0.8.1

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

Source distribution (sdist)

Source distribution for dompruner 0.8.1
File Size Uploaded
dompruner-0.8.1.tar.gz 42.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dompruner 0.8.1
File Interpreter ABI Platform
dompruner-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 68.7 kB

Release files / dompruner-0.8.1.tar.gz

Download URL dompruner-0.8.1.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4550439cf28275a5df468a8e3d4973ada9e26995c845ea71e878de9055300957
BLAKE2b-256 checksum
How to use checksums
4a28aaeb72a792f492fed917657ca5bba3ba07cf937b394c7ae2b1e9bdfa7b68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 12, 2026.

Transparency log

Release files / dompruner-0.8.1-py3-none-any.whl

Download URL dompruner-0.8.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94277f9360ef4aaf0472796ecf7739dd297e741abb8160f19dda7b4659cb54da
BLAKE2b-256 checksum
How to use checksums
94bb626bbf769db12cdd25add385656f70b612c4b6c3f0607840d77c46d295cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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