Skip to main content

Webson 🕸️

Turn any webpage into structured outputs! ⚡️
Extract data from any website with the power of AI.


✨ Overview

Webson is a cutting-edge tool that transforms webpages into structured data models — all with just a few lines of code. No more manual scraping or complex parsers! With Webson, you can effortlessly convert HTML into meaningful, actionable insights using state-of-the-art Language Models (LLMs) from IntelliBricks and robust automation powered by Playwright.


🎯 Key Features

  • 🦾 Intelligent Data Extraction:
    Convert webpages into structured data using your own defined models.
    (Say goodbye to messy HTML!)

  • 💬 Chat Casting:
    Simply tell Webson what you need in plain language, and it will extract and structure the data for you.
    (Example: "Extract product details from https://amazon.com and shopee.com including title, price, and rating.")

  • ⚡️ Seamless Integration:
    Built on top of IntelliBricks and Playwright — enjoy a Python-first approach without the boilerplate.

  • 📊 Structured Outputs:
    Define your output schemas with msgspec.Struct and get data back in a ready-to-use, strongly typed format.


🚀 Installation

Install Webson and its dependencies via pip:

pip install webson

Important: Webson relies on Playwright for web automation. This happens because we all know that many pages rely on things that only happen in a browser, like loading stripts, styles, etc. Follow these steps to install Playwright and its browser dependencies:

  1. Install Playwright:

    pip install playwright
    
  2. Install Browser Binaries:

    playwright install
    

Now you’re all set to transform any webpage into structured intelligence!


🔧 Usage Examples

1. Casting a Webpage into a Structured Model

Define your own data model and cast a webpage’s content into it:

import msgspec
from intellibricks.llms import Synapse
from webson import Webson
from typing import Annotated

# Define your desired structured model
class PageSummary(msgspec.Struct):
    title: str
    summary: Annotated[
      str,
      msgspec.Meta(
        description="A short summary of the page")
    ]

# Initialize your LLM (using IntelliBricks Synapse) and Webson
llm = Synapse.of("google/genai/gemini-pro-experimental")
webson = Webson(llm=llm, timeout=5000)

# Cast the webpage content into your structured model
structured_data = webson.cast(PageSummary, "https://example.com")
print(f"Title: {structured_data.title}")
print(f"Content: {structured_data.summary}")

2. High-Level Query to Struct

Simply describe what you need and let Webson do the heavy lifting:

from intellibricks.llms import Synapse
from webson import Webson

# Initialize your LLM and Webson instance
llm = Synapse.of("google/genai/gemini-pro-experimental")
webson = Webson(llm=llm, timeout=5000)

# Use natural language to instruct Webson on what data to extract
results = webson.query_to_struct(
    "Extract product info from https://amazon.com and https://www.walmart.com/ including title, price, and rating."
)
for url, output in results:
    print(url, output)

⚙️ How It Works

  1. Webpage Automation:
    Webson uses Playwright to open webpages in a headless browser and retrieve the HTML content.

  2. Markdown Conversion:
    The raw HTML is converted into Markdown for improved text processing and parsing.

  3. LLM-Powered Casting:
    The transformed Markdown is sent to your LLM (via IntelliBricks) which then returns structured data based on your specified schema.


🤝 Contributing

We welcome contributions to make Webson even more awesome!
If you encounter any issues or have ideas for new features, please open an issue or submit a pull request on our GitHub repository.


📜 License

This project is licensed under the APACHE 2.0 License.


Metadata

Release files for webson 0.1.6

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

Source distribution (sdist)

Source distribution for webson 0.1.6
File Size Uploaded Provenance
webson-0.1.6.tar.gz 45.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 59.0 kB

Release files / webson-0.1.6.tar.gz

Download URL webson-0.1.6.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
767c54db3eaafbb2cf0e9aa5e8883c49586f5b84fc2b273f29e3cd4ee18b6b84
BLAKE2b-256 checksum
How to use checksums
f740eba99a63e253f887a71a65e817785e5665acfb9e853bfb14de8d5b771b1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / webson-0.1.6-py3-none-any.whl

Download URL webson-0.1.6-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71ac758e7f0503a3acc842b0872d9d248e739b24d3c28e5a52609e6a1a7c200c
BLAKE2b-256 checksum
How to use checksums
5871509292be3f301b59530e80208fd523be75680383bfc7dd828f0e8f7409d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for webson 0.1.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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