Wikipedia
A Wikipedia domain parser that reads cached responses from the shared cache owned by @svendowideit/web-cache. It fetches nothing itself — fetch, cache, pacing and rate-limit retry are web-cache's job.
WHAT IT DOES
Parses cached MediaWiki responses into structured swamp data: opensearch search, a page's wikitext/HTML/Parsoid/summary/JSON, and an infobox extracted as key/value pairs. Markdown output extensions and URL-only cache-key scheme make it composable with the fetch seam.
INSTALL
swamp extension pull @svendowideit/web-cache
swamp extension pull @svendowideit/wikipediaDEPENDENCIES
@svendowideit/web-cache (hard dependency, declared in this manifest). No host packages are installed.
RUN
# Fetch + cache a page.
swamp model @svendowideit/web-cache method run get cache \
--input url="https://en.wikipedia.org/w/api.php?action=parse&page=Alfred+Bester&prop=wikitext&format=json"
# Parse the cached page's wikitext.
swamp model @svendowideit/wikipedia method run get-page wiki \
--input title="Alfred Bester" --input format=wikitext
# Search cached opensearch results.
swamp model @svendowideit/wikipedia method run search wiki \
--input query="Alfred Bester"CONFIGURE
All optional global arguments: cacheDir (default ~/.swamp/web-cache), apiUrl (default en.wikipedia.org), restUrl (default en.wikipedia.org). See the README for the full argument tables.
UPGRADE
This extension installs nothing on the host, so an upgrade is:
swamp extension updateModel definitions record the version they were created with; the model's bundled upgrades entry migrates them on the next method run. Swamp data is preserved.
WHAT IT INSTALLS
Nothing on the host — no services, triggers, or webhooks. Only pulled extension files and swamp data resources.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| cacheDir? | string | Shared web-cache directory to read cached responses from (must match |
| apiUrl? | string | MediaWiki action API base URL |
| restUrl? | string | Wikipedia REST v1 base URL |
| Argument | Type | Description |
|---|---|---|
| limit? | number | Maximum number of results |
| Argument | Type | Description |
|---|---|---|
| titles | array | Candidate page titles |
| Argument | Type | Description |
|---|---|---|
| titles | array | Candidate page titles to resolve |
| key? | string | Optional data name for the result (defaults to joined titles). |
| url? | string | Exact page-props URL to read from the cache (omit to derive). |
| Argument | Type | Description |
|---|---|---|
| limit? | number | Maximum number of results |
| key? | string | Optional data name for the result (defaults to the query). |
| url? | string | Exact URL to read from the cache. When omitted, the URL is derived |
| Argument | Type | Description |
|---|---|---|
| url? | string | Exact URL to read from the cache. When omitted, derived from |
| Argument | Type | Description |
|---|---|---|
| template? | string | Restrict to a specific infobox template name (e.g. 'writer', 'book'). |
| key? | string | Optional data name for the result (defaults to the title). Pass the |
| url? | string | Exact wikitext URL to read from the cache. When omitted, derived from |
Resources
Search Wikipedia (opensearch) through the shared cache, transparently. The caller does not care whether a network fetch happened or a cache hit was used (the `cached` flag is returned as metadata only). Steps: build the opensearch URL → web-cache-fetch → parse the cached body. Inputs: query — search term limit — max results (default 5) key — optional data name for the result (defaults to query) cacheDir — shared cache dir (default ~/.swamp/web-cache)
Fetch + parse a Wikipedia page through the shared cache, transparently. The caller does not care whether a network fetch happened or a cache hit was used. Steps: build the page URL → web-cache-fetch → parse the cached body. Inputs: title — page title format — wikitext | html | parsoid | summary | json (default wikitext) cacheDir — shared cache dir (default ~/.swamp/web-cache)
Extract a page's infobox as key/value pairs through the shared cache, transparently. The caller does not care whether a fetch happened or a cache hit was used. Steps: build the wikitext page URL → web-cache-fetch → parse + extract the infobox. Inputs: title — page title template — optional infobox template name to restrict to (e.g. writer, book) key — optional data name for the result (defaults to title) cacheDir — shared cache dir (default ~/.swamp/web-cache)
Resolve candidate page titles to canonical title, URL, short description and Wikidata QID via a batched page-props query, through the shared cache. The caller does not care whether a fetch happened or a cache hit was used. Steps: build the page-props URL → web-cache-fetch → parse the cached body. Inputs: titles — array of candidate page titles key — optional data name for the result (defaults to joined titles) cacheDir — shared cache dir (default ~/.swamp/web-cache)
Modified 1 behaviors. Added 4 workflows. updated dependencies
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License1/2partial
no SPDX license declared
- Verified public repository2/2earned