Skip to content

plasmate-labs/quickstart-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Plasmate Quickstart — Rust

Use this template Test

A minimal template showing how to use Plasmate from Rust. Fetch web pages and get back a structured Semantic Object Model (SOM) instead of raw HTML.

Prerequisites

Install Plasmate:

cargo install plasmate

Quick Start

# Clone this template
gh repo create my-scraper --template plasmate-labs/quickstart-rust --clone
cd my-scraper

# Run it
cargo run -- https://news.ycombinator.com

How It Works

The example calls Plasmate as a CLI subprocess and parses the JSON SOM output:

use std::process::Command;

let output = Command::new("plasmate")
    .args(["fetch", "https://example.com"])
    .output()
    .expect("Failed to run plasmate");

let som: serde_json::Value =
    serde_json::from_slice(&output.stdout)
    .expect("Failed to parse SOM");

println!("Title: {}", som["title"]);
println!("Regions: {}", som["regions"].as_array().map_or(0, |r| r.len()));

The SOM gives you structured access to page content — headings, links, images, and text organized by semantic regions (navigation, main content, sidebars, etc.).

Project Structure

├── Cargo.toml          # Dependencies
├── src/
│   └── main.rs         # Fetch and display SOM content
└── .github/
    └── workflows/
        └── test.yml    # CI workflow

License

MIT


Part of the Plasmate Ecosystem

Engine plasmate - The browser engine for agents
MCP plasmate-mcp - Claude Code, Cursor, Windsurf
Extension plasmate-extension - Chrome cookie export
SDKs Python / Node.js / Go / Rust
Frameworks LangChain / CrewAI / AutoGen / Smolagents
Tools Scrapy / Audit / A11y / GitHub Action
Resources Awesome Plasmate / Notebooks / Benchmarks
Docs docs.plasmate.app
W3C Web Content Browser for AI Agents

About

Quickstart template: use Plasmate with Rust. Fetch any URL and get structured SOM JSON.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages