一键导入
fandom-cli
Query Fandom and other MediaWiki wikis via API. Triggers: fandom, wiki, mediawiki, infobox, search.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Query Fandom and other MediaWiki wikis via API. Triggers: fandom, wiki, mediawiki, infobox, search.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | fandom-cli |
| description | Query Fandom and other MediaWiki wikis via API. Triggers: fandom, wiki, mediawiki, infobox, search. |
Query any Fandom wiki (or other MediaWiki-based wiki like Miraheze) via MediaWiki API. Fetches pages, infoboxes, categories, search results, and images.
~/.local/bin/fandom --help # preferred Cohub wrapper
fandom --help # available on PATH
python -m fandom_cli --help # module in PYTHONPATH or pip-installed
python -m fandom_cli.cli --help # fallback: cd to skill directory first
If none of the above work, install into a sandbox-local venv outside the workspace:
SKILL_DIR="/workspace/.agents/skills/fandom-cli"
python3 -m venv ~/venvs/fandom-cli
PIP_USER=false ~/venvs/fandom-cli/bin/pip install --upgrade pip
PIP_USER=false ~/venvs/fandom-cli/bin/pip install -e "$SKILL_DIR"
mkdir -p ~/.local/bin
ln -sf ~/venvs/fandom-cli/bin/fandom ~/.local/bin/fandom
export PATH="$HOME/.local/bin:$PATH"
If editable install is unavailable, install dependencies and use PYTHONPATH:
SKILL_DIR="/workspace/.agents/skills/fandom-cli"
python3 -m venv ~/venvs/fandom-cli
PIP_USER=false ~/venvs/fandom-cli/bin/pip install typer httpx beautifulsoup4 markdownify
mkdir -p ~/.local/bin
cat > ~/.local/bin/fandom << 'SCRIPT'
#!/bin/bash
export PYTHONPATH="/workspace/.agents/skills/fandom-cli:${PYTHONPATH:-}"
exec "$HOME/venvs/fandom-cli/bin/python" -m fandom_cli.cli "$@"
SCRIPT
chmod +x ~/.local/bin/fandom
export PATH="$HOME/.local/bin:$PATH"
api.php endpoint must be reachableFANDOM_PROXY_URL if you expect blocked requestsHard rule: 1 request per second. The CLI enforces this internally. Do not attempt to bypass or parallelize calls. Fandom's API goodwill depends on responsible use.
Fandom wikis — use the subdomain:
dontstarveharrypotterresidentevilNon-Fandom MediaWiki wikis (e.g. Miraheze) — use the full hostname:
1d6chan.miraheze.org/w/api.php (standard MediaWiki path)Full URL base — pass a complete API endpoint:
https://custom.wiki/api.phpImportant: Non-Fandom wikis may be behind Cloudflare. Set
FANDOM_PROXY_URLto route requests through a serverless proxy. Without it, Cloudflare-protected wikis will fail with 403. The proxy's/proxy?url=endpoint is used automatically for non-Fandom hosts when Cloudflare is detected.
When unclear, ask the user: "Which wiki? (Fandom subdomain or full hostname)"
| User intent | Command |
|---|---|
| Read page content | fandom page <wiki> <title> --format markdown |
| Get structured data (stats, attributes) | fandom infobox <wiki> <title> |
| Discover pages by type | fandom category <wiki> <name> --limit N |
| Search for a topic | fandom search <wiki> <query> --limit N |
| Get page images | fandom images <wiki> <title> --entity-match --limit N |
| Get page metadata | fandom metadata <wiki> <title> |
Note: If the
fandomcommand is unavailable, try~/.local/bin/fandomfirst. If that also fails, install the sandbox-local venv shown above. Do not create or rely on a.venvinside the workspace skill directory.
page --format markdown: Return raw markdown to user (best for reading)page --format json: Parse JSON, extract html or other fields as neededpage --format text: Return plain text (most compact)infobox: Returns JSON key-value pairs. Present in structured formatcategory: Returns list of pages with titles and URLs. Present as bulleted listsearch: Returns ranked results with snippets. Present top matchesimages: Returns image URLs and filenames. Can render markdown images or list URLsmetadata: Returns pageid, URL, categories. Use for verification or linking| Error | Cause | Action |
|---|---|---|
| "Page not found" | Title doesn't exist | Try search: fandom search <wiki> <partial title> |
| "No infobox found" | Page lacks portable-infobox | Fall back to fandom page <wiki> <title> --format markdown |
| Empty category | Category has no direct pages (only subcats) | Try broader category or search |
| API Error [429] | Rate limited | Wait and retry (CLI auto-retries 3x) |
| Empty search | No matches | Broaden query or check wiki subdomain |
~/.local/bin/fandom or fandom first. If unavailable, install the sandbox-local venv before falling back to python -m fandom_cli.dontstarve not Don't Starvefandom page dontstarve "Dark Sword"' and spaces, but quote the shell argumentfandom category dontstarve Characters works same as Category:CharactersThis tool relies on Fandom's free API. When using it:
Successful API responses are cached on disk for 24 hours by default. Set FANDOM_CACHE_TTL_SECONDS=0 to disable. See README.md for configuration details.
The module isn't in Python's search path. Fix by installing the skill into a sandbox-local venv:
SKILL_DIR="/workspace/.agents/skills/fandom-cli"
python3 -m venv ~/venvs/fandom-cli
PIP_USER=false ~/venvs/fandom-cli/bin/pip install --upgrade pip
PIP_USER=false ~/venvs/fandom-cli/bin/pip install -e "$SKILL_DIR"
mkdir -p ~/.local/bin
ln -sf ~/venvs/fandom-cli/bin/fandom ~/.local/bin/fandom
export PATH="$HOME/.local/bin:$PATH"
If editable install is unavailable, use the PYTHONPATH wrapper from Preconditions.
Do not use system pip. Create ~/venvs/fandom-cli/ and install there with PIP_USER=false, or use the PYTHONPATH wrapper from Preconditions.
If fandom-cli hits Cloudflare protection (403), it automatically retries through the
serverless proxy configured by FANDOM_PROXY_URL.
/?wikiname=... endpoint/proxy?url=... generic endpointThe same FANDOM_PROXY_URL env var covers both cases — the CLI selects the right
proxy format automatically.
See reference/DENO_DEPLOY.md for Deno registration, deployment steps, and proxy code.
If FANDOM_PROXY_URL is missing or unavailable: