Skip to main content

Crate websearch

Crate websearch 

Source
Expand description

Zero-infrastructure web search via DuckDuckGo Lite scraping.

No API key, no backend. Results reuse the same reference-style URL preservation as the fetch path: each hit’s title carries an inline [N] marker and the full URLs are collected into a reference block, keeping the context window tight while staying citable.

Modules§

compress
extract
Parse DuckDuckGo Lite’s table layout into structured results.
refs
Shared reference-style URL preservation.
types
Types for the web-search layer.

Functions§

build_output
Parse an already-fetched results page into a SearchOutput (no network).
build_refs
Build the reference block (index → URL) from parsed results.
fetch_ddg_lite
Fetch the raw DuckDuckGo Lite results page for a query, retrying transient failures (connection/timeout, 5xx, 429) with exponential backoff.
format_results
Render the inline body: each result as title [N] followed by its snippet. URLs are intentionally absent here — they live in the reference block.
render_references
Render the reference block appended to text output. Thin wrapper over crate::refs::render_block.
run_search
Fetch and parse a query end to end.