Skip to main content

SchemaSnap

PyPI version Python License: MIT tests

HTML → typed tables, forms, lists as JSON. 30ms, no key, no browser.

Born from shadow-web's SchemaSnap module. A parse primitive — not a scraper, not a crawler. Feed it HTML, get structured data.

pip install "schemasnap[server]"
uvicorn schemasnap.server:app --port 8000 &

curl -X POST http://127.0.0.1:8000/v1/compress \
  -H "Content-Type: application/json" \
  -d '{"html":"<table><thead><tr><th>Product</th><th>Price</th><th>Stock</th></tr></thead><tbody><tr><td>Widget</td><td>$19.99</td><td>150</td></tr></tbody></table>"}'
{"tables":[{"columns":["Product","Price","Stock"],
  "types":["string","currency","integer"],
  "rows":[["Widget","$19.99","150"]]}]}

Self-hosted API

There is no hosted endpoint — the Cloud Run deployment was retired in October 2026. Run it yourself; it is two commands:

pip install "schemasnap[server]"
uvicorn schemasnap.server:app --port 8000
Endpoint Auth Notes
POST /v1/compress — HTML → structured JSON none by default stateless, pure lxml, ~30 ms
GET /v1/health none reads __version__ from the package
POST /v1/extract — URL → structured JSON — off unless you set DISABLE_EXTRACT=0; needs Playwright

Quick install

pip install schemasnap

# For MCP (Cursor, Claude Desktop)
pip install "schemasnap[mcp]"

# For URL extraction (requires Playwright)
pip install "schemasnap[browser]"
playwright install chromium

Usage

Python SDK

from schemasnap import extract_from_html, parse_page

# From HTML string (no browser, 30ms)
result = extract_from_html(open("page.html").read())
print(result.tables)      # [{columns, types, rows, total_rows}]
print(result.forms)       # [{action, method, fields}]
print(result.lists)       # [{type, items, total}]
print(result.token_budget) # {raw_bytes, compressed_bytes, compression_ratio}

MCP (Cursor, Claude Desktop)

pip install "schemasnap[mcp]"

Add to Cursor Settings → MCP:

{
  "mcpServers": {
    "schemasnap": {
      "command": "schemasnap-mcp"
    }
  }
}

Tool: compress_html(html, max_rows_per_table=50, url="") → typed tables, forms, lists, actions.

curl (no Python needed)

curl -X POST http://127.0.0.1:8000/v1/compress \
  -H "Content-Type: application/json" \
  -d '{"html": "<table>...your html...</table>"}'

Benchmarks

Page Raw Compressed Savings Latency
Wikipedia GDP 641 KB 215 KB 66% 256ms
W3Schools Tables 212 KB 87 KB 59% 34ms
Hacker News 35 KB 24 KB 32% 23ms

Measured July 2026 on a 1 vCPU / 256 MB instance (Cloud Run, us-central1), Python 3.12. Cold start ~250 ms — irrelevant when you call the library in-process.

Features

  • Tables → columns, types (string|integer|number|currency|percentage|date|email|url), rows — from <table>, ARIA role=table|grid, Tailwind grids, or .row pseudo-tables
  • Forms → action, method, fields with name, type, label, required, placeholder, pattern, minlength, select options
  • Lists → type (unordered|ordered|select), items, total
  • Semantic groups → "Login Form", "Navigation", "Checkout", "Search" auto-detected
  • Deterministic — same input → same output. No LLM guess, $0 per call

Competitive positioning

SchemaSnap is a parse primitive, not a scraper:

Firecrawl / Jina     =  URL → content (crawl + render)
Crawl4AI             =  URL → markdown (self-host crawl)
pandas read_html()   =  HTML → strings (dev tool)
SchemaSnap           =  HTML → typed structure (agent utility)

Composable: Firecrawl fetch → SchemaSnap parse. Or curl → SchemaSnap parse.

Honest limits: HTML only (no JS render), layout tables skipped, no crawl, no proxy rotation.

Relationship to shadow-web

SchemaSnap started as schema_snap.py inside shadow-web — a broader agent-facing web interaction suite. This standalone version:

  • Adds MCP server (compress_html tool) for Cursor / Claude Desktop
  • Inlines semantic grouping (no external dependency)
  • Fixes tree mutation bug during tag removal
  • Adds deterministic type inference (8 types)
  • Hardened for public API (SSRF guard, rate limiting, oversize protection)

License

MIT


#web-scraping #data-extraction #ai-agents #html-parser #json-api #python #llm-tools

Metadata

Release files for schemasnap 0.1.9

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

Source distribution (sdist)

Source distribution for schemasnap 0.1.9
File Size Uploaded
schemasnap-0.1.9.tar.gz 34.3 kB Details

Built distribution (wheel)

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

Total release size: 59.4 kB

Release files / schemasnap-0.1.9.tar.gz

Download URL schemasnap-0.1.9.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
df2589cf89f5f259fc9de804b522b8d24af28c2f52d997b068a0c31ffd9de324
BLAKE2b-256 checksum
How to use checksums
e492f93df440631bc6433a9046010709dde97bff00ced84cbd5409a46f48cf73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / schemasnap-0.1.9-py3-none-any.whl

Download URL schemasnap-0.1.9-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b58e0833fd0df7e10e5396b70b5d5551c7c5977e039b10670a2532ff0dbd27d
BLAKE2b-256 checksum
How to use checksums
c939bf6932374d10d39eed632d9e53bf375dc22bd86b97a018a58df9e0edda9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.1

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