Skip to main content

Structured data extraction from any URL — tables, forms, lists as JSON. No API key needed.

Project description

SchemaSnap

Structured data extraction from any URL — tables, forms, lists as JSON.

Born from shadow-web's SchemaSnap module. Focused, standalone, and designed to be the API that AI agents (and humans) call when they need structured web data.

from schemasnap import extract_from_url

result = extract_from_url("https://en.wikipedia.org/wiki/List_of_countries_by_GDP")
# result.tables[0] → {columns: ["Country", "GDP", ...], types: ["string", "currency", ...], rows: [[...], ...]}
# result.forms   → [{action: "/search", method: "GET", fields: [...]}]
# result.lists   → [{type: "unordered", items: ["Item 1", "Item 2"], total: 2}]

What it does

Input Output Browser needed?
URL Tables + Forms + Lists as JSON Yes (Playwright)
Raw HTML Tables + Forms + Lists as JSON No (lxml only)

Quick install

pip install schemasnap

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

# For API server
pip install "schemasnap[server]"

Usage

Python SDK

from schemasnap import extract_from_url, extract_from_html, parse_page

# From URL (needs Playwright)
result = extract_from_url("https://example.com/data")
print(result.tables)      # [{columns, types, rows, total_rows, ...}]
print(result.forms)       # [{action, method, fields: [{name, type, label, required}]}]
print(result.lists)       # [{type, items, total}]
print(result.token_budget) # {raw_bytes, compressed_bytes, compression_ratio}

# From HTML string (no browser)
html = open("page.html").read()
result = extract_from_html(html)
print(result.tables)

API Server

pip install "schemasnap[server]"
uvicorn schemasnap.server:app --reload --port 8000
# Extract from URL
curl -X POST http://localhost:8000/v1/extract \
  -H "Content-Type: application/json" \
  -d '{"url": "https://en.wikipedia.org/wiki/List_of_countries_by_GDP"}'

# Compress HTML
curl -X POST http://localhost:8000/v1/compress \
  -H "Content-Type: application/json" \
  -d '{"html": "<table>...", "url": "https://example.com"}'

# Health check
curl http://localhost:8000/v1/health

Features

  • Tables → columns, types (string/integer/number/currency/percentage/date/email/url), rows, total_rows
  • Forms → action, method, fields with name, type, label, required, placeholder, options
  • Lists → type (unordered/ordered/select), items, total
  • HTML compression → 83-97% size reduction before extraction
  • Semantic groups → "Login Form", "Navigation", "Checkout" auto-detected

Relationship to shadow-web

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

  • Removes MCP server, security scan, self-healing, form fill, browser-use integration
  • Inlines semantic grouping (no external dependency)
  • Fixes the tree mutation bug during tag removal
  • Adds FastAPI server with rate limiting and input validation
  • Focuses entirely on one thing: URL → structured data

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schemasnap-0.1.1.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schemasnap-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file schemasnap-0.1.1.tar.gz.

File metadata

  • Download URL: schemasnap-0.1.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for schemasnap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3f297bb5e09b9167430489e8143742f1fcd653806e7a78e39d3938dbf37690d8
MD5 b94b5776ff88effed6524e8499035711
BLAKE2b-256 844dc7bc135025d9e926acc910c8ae9639e9e14ebf33ba245b01a194226dc617

See more details on using hashes here.

File details

Details for the file schemasnap-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: schemasnap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for schemasnap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 757703247c7221fd7b806cccf95a8ed715ed74647a500f626b5c061f70bf5e32
MD5 f07c64f0273b05c3b45f3eab287bf2b0
BLAKE2b-256 2de2536722c906bc788c87d07b500a6dfa581a6d077506dbffb8f9a7c500cdc8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page