Skip to main content

Wikipedia

@svendowideit/wikipediav2026.10.23.1· 1d agoBEHAVIORSWORKFLOWS
01README

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/wikipedia

DEPENDENCIES

@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 update

Model 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.

02Behaviors1
@svendowideit/wikipediav2026.10.23.1wikipedia.ts

Global Arguments

ArgumentTypeDescription
cacheDir?stringShared web-cache directory to read cached responses from (must match
apiUrl?stringMediaWiki action API base URL
restUrl?stringWikipedia REST v1 base URL
fn search-url(limit?: number)
Build the opensearch URL for a query (no fetching). Use this to feed
ArgumentTypeDescription
limit?numberMaximum number of results
fn page-url()
Build the page URL for a title in a format (no fetching). Use this to
fn page-props-url(titles: array)
Build a batched page-props query URL for candidate titles (no
ArgumentTypeDescription
titlesarrayCandidate page titles
fn get-page-props(titles: array, key?: string, url?: string)
Parse a cached page-props response into canonical title → url,
ArgumentTypeDescription
titlesarrayCandidate page titles to resolve
key?stringOptional data name for the result (defaults to joined titles).
url?stringExact page-props URL to read from the cache (omit to derive).
fn search(limit?: number, key?: string, url?: string)
Parse a cached opensearch response for a query into corrected titles,
ArgumentTypeDescription
limit?numberMaximum number of results
key?stringOptional data name for the result (defaults to the query).
url?stringExact URL to read from the cache. When omitted, the URL is derived
fn get-page(url?: string)
Parse a cached Wikipedia page into content. `format` defaults to
ArgumentTypeDescription
url?stringExact URL to read from the cache. When omitted, derived from
fn get-infobox(template?: string, key?: string, url?: string)
Extract a page's infobox into key/value pairs from cached wikitext.
ArgumentTypeDescription
template?stringRestrict to a specific infobox template name (e.g. 'writer', 'book').
key?stringOptional data name for the result (defaults to the title). Pass the
url?stringExact wikitext URL to read from the cache. When omitted, derived from

Resources

page(infinite)— A parsed Wikipedia page (content from the shared cache)
search(infinite)— Parsed search results (from the shared cache)
infobox(infinite)— Extracted infobox key/value pairs for a page
url(infinite)— A built MediaWiki URL (for the fetch seam)
page-props(infinite)— Parsed page-props (canonical title, url, shortdesc, wikidataId)
03Workflows4
@svendowideit/wikipedia-searchafa7d34c-dd6b-43d7-8f5b-f0f2a2d35637

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)

mainSearch Wikipedia through the cache.
1.build-url— Build the opensearch URL for the query.
2.fetch— Fetch + cache the opensearch URL.
3.parse— Parse the cached opensearch body into results.
@svendowideit/wikipedia-page99bfa21c-c791-46c3-9799-20a3404e9146

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)

mainFetch + parse a Wikipedia page.
1.build-url— Build the page URL for the title/format.
2.fetch— Fetch + cache the page URL.
3.parse— Parse the cached page body into content.
@svendowideit/wikipedia-infobox624cd7eb-0e2d-4c8a-83b3-1f9975220a9e

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)

mainExtract an infobox from a page.
1.build-url— Build the wikitext page URL.
2.fetch— Fetch + cache the wikitext URL.
3.parse— Extract the infobox from the cached wikitext.
@svendowideit/wikipedia-page-props2ccc92c6-546a-417d-8c47-50a1b6ac3508

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)

mainResolve candidate titles via page-props.
1.build-url— Build the batched page-props query URL.
2.fetch— Fetch + cache the page-props URL.
3.parse— Parse the cached page-props body.
04Previous Versions2
2026.09.20.4

Modified 1 behaviors. Added 4 workflows. updated dependencies

2026.09.20.3
05Stats
A
93 / 100
Downloads
30
Archive size
15.9 KB
  • 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
06Platforms