Skip to content
fandom

v0.2.0

MediaWiki API plane, wikitext parser, and six new commands.

Released 2026-06-18

v0.2.0 adds a second API plane on top of the Fandom v1 layer from v0.1.0. All six new commands talk to the MediaWiki Action API, which is available on every Fandom wiki at {wiki}.fandom.com/api.php. No new dependencies, no API key.

New commands

page

fandom --wiki starwars page "Luke Skywalker" -o json
fandom --wiki minecraft page "Creeper" --no-wikitext | jq .infobox_fields

Fetches a full article by title and returns everything the MediaWiki API exposes. Fields: id, title, display_title, ns, url, abstract, wikitext, plain_text, categories, images, internal_links, external_links, templates, infobox_fields, thumbnail, last_editor, revision_id, page_length, word_count, is_redirect, updated_at.

plain_text is the wikitext rendered to Markdown. infobox_fields is a flat key-value map extracted from the first infobox template. internal_links is the full outlink graph for the page.

Use --no-wikitext to drop the raw source when you only need the parsed fields.

allpages

fandom --wiki starwars allpages | wc -l
fandom --wiki minecraft allpages -o jsonl > stubs.jsonl

Paginates through the MediaWiki allpages list and streams every page stub in namespace 0. Each record has id, ns, title, and url. Without --limit it runs to completion. This is the BFS seed for reconstructing an entire wiki without missing a page. See BFS full-wiki crawl for the pattern.

revisions

fandom --wiki starwars revisions "Darth Vader" -n 50

Returns the revision history of a page. Fields: rev_id, page_id, title, editor, timestamp, comment, size.

siteinfo

fandom --wiki starwars siteinfo
fandom --wiki minecraft siteinfo -o json | jq .articles

Returns aggregated statistics for the wiki: article count, total page count, total edits, image count, and registered user count.

recent

fandom --wiki starwars recent -n 50
fandom --wiki minecraft recent | jq 'select(.type == "new")'

Streams recent changes from the MediaWiki recentchanges list. Unlike activity (which only covers edits via the Fandom v1 API), recent includes new page creations, log actions, and categorize events, with revision IDs and full edit comments.

wikis

fandom wikis --search "one piece"
fandom wikis --hub Gaming -n 20
fandom wikis -o jsonl | jq .slug

Discovers wikis on fandom.com by keyword or content hub. Known hubs: Gaming, Movies, TV, Books, Comics, Anime, Music, Lifestyle, Entertainment, Education. Uses the Fandom f2 JSON feed first and falls back to HTML slug extraction when the feed returns no results.

New library: wikitext parser

fandom/parser.go adds a pure-Go wikitext processor used internally by the page command.

  • wikitextToMarkdown: converts wikitext to clean Markdown (headers, bold/italic, lists, tables, internal and external links, template stripping)
  • extractInfobox: extracts key-value pairs from any {{Infobox ...}} or structured template
  • extractCategories, extractImages, extractInternalLinks, extractExternalLinks, extractTemplates: link and asset graph extractors

These functions are in the fandom package and available for import.

New types

Six new public types in fandom/types.go:

Type Fields
WikiStub slug, name, hub, url
PageStub id, ns, title, url
FullArticle 20+ fields (see page above)
Revision rev_id, page_id, title, editor, timestamp, comment, size
SiteInfo site_name, wiki, url, articles, pages, edits, images, users
RecentChange type, ns, title, page_id, rev_id, user, timestamp, comment

Install

go install github.com/tamnd/fandom-cli/cmd/[email protected]

Or download a prebuilt binary from the release page.