Wikipedia Commands
Overview
The netapi wiki commands provide CLI access to Wikipedia via two APIs. All commands support -f json for jq piping.
-
REST v1 API (
en.wikipedia.org/api/rest_v1/) — modern, clean JSON responses for page summaries -
Action API (
en.wikipedia.org/w/api.php) — full-featured: search, extracts, categories, links
Prerequisites
No authentication required. Both APIs are public, free, and have no documented rate limits. Set a descriptive User-Agent for courtesy.
# No tokens or keys needed
netapi wiki summary "OAuth"
Commands (10 total)
| Command | Description |
|---|---|
|
Get article summary (title, description, extract) |
|
Search articles by query |
|
Get full article text or specific sections |
|
List links from an article |
|
List categories an article belongs to |
|
List available language versions |
|
Get related articles |
|
Get random article(s) |
|
Events on a specific date |
|
Raw API access |
JSON Output
All commands support -f json for machine-readable output:
netapi wiki summary "OAuth" -f json
netapi wiki search "network access control" -f json
netapi wiki extract "RADIUS" -f json
jq Patterns
Exploring Structure
# See all keys in summary response
netapi wiki summary "OAuth" -f json | jq 'keys'
# Full summary object
netapi wiki summary "OAuth" -f json | jq '.'
Article Summaries
# Title + extract
netapi wiki summary "HMAC" -f json | jq '{title, description, extract}'
# Just the extract text
netapi wiki summary "802.1X" -f json | jq -r '.extract'
# Thumbnail URL
netapi wiki summary "Cisco Systems" -f json | jq -r '.thumbnail.source // "No thumbnail"'
# Article URL
netapi wiki summary "RADIUS" -f json | jq -r '.content_urls.desktop.page'
Search Results
# Search with title + snippet
netapi wiki search "network access control" -f json | jq '.[] | {title, snippet}'
# Titles only
netapi wiki search "certificate authority" -f json | jq -r '.[].title'
# Search with result count
netapi wiki search "authentication protocol" -f json | jq 'length'
Multi-Article Lookup
# Look up multiple terms
for term in "OAuth" "RADIUS" "802.1X" "HMAC" "TLS"; do
netapi wiki summary "$term" -f json | jq --arg t "$term" '{term: $t, extract: .extract[0:150]}'
done | jq -s '.'
# Quick glossary
for term in "SAML" "LDAP" "Kerberos"; do
netapi wiki summary "$term" -f json | jq -r '"\(.title): \(.description // .extract[0:100])"'
done
Raw API Access
# REST v1: any endpoint
netapi wiki api /page/summary/OAuth | jq '.'
# Action API: any query
netapi wiki api "action=query&list=search&srsearch=firewall&format=json" | jq '.'
Environment Variables
| Variable | Description |
|---|---|
|
Language edition (default: |
|
Custom User-Agent (optional, courteous) |
Useful jq Recipes
Quick Definition Lookup
netapi wiki summary "OAuth" -f json | jq -r '"\(.title) — \(.description)\n\n\(.extract)"'
curl Equivalents (Works Now)
These raw curl + jq patterns work today without the netapi CLI. No authentication required.
Article Summary (REST v1)
# Get article summary
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/OAuth" \
| jq '{title, description, extract}'
# Quick definition
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/HMAC" \
| jq -r '"\(.title): \(.extract[0:200])"'
# Multiple lookups
for term in "OAuth" "RADIUS" "802.1X" "HMAC" "TLS"; do
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/${term}" \
| jq -r '"\(.title): \(.description // .extract[0:80])"'
done
# Get article URL
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/Cisco_Systems" \
| jq -r '.content_urls.desktop.page'
Search Articles (Action API)
# Search for articles
curl -s "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=network+access+control&format=json&srlimit=5" \
| jq '.query.search[] | {title, snippet: (.snippet | gsub("<[^>]+>"; ""))[0:120]}'
# Titles only
curl -s "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=certificate+authority&format=json&srlimit=10" \
| jq -r '.query.search[].title'
# Search with total hit count
curl -s "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=authentication+protocol&format=json&srlimit=5" \
| jq '{total: .query.searchinfo.totalhits, results: [.query.search[].title]}'
Full Article Extract
# Get full article text (plain text, no HTML)
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=RADIUS&prop=extracts&explaintext=true&format=json" \
| jq -r '.query.pages[].extract[0:500]'
# Get article intro only
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=OAuth&prop=extracts&explaintext=true&exintro=true&format=json" \
| jq -r '.query.pages[].extract'
Article Categories and Links
# Categories
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=RADIUS&prop=categories&format=json&cllimit=20" \
| jq -r '.query.pages[].categories[].title'
# Outgoing links
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=OAuth&prop=links&format=json&pllimit=20" \
| jq -r '.query.pages[].links[].title'
# Language versions available
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=OAuth&prop=langlinks&format=json&lllimit=50" \
| jq -r '.query.pages[].langlinks[] | "\(.lang): \(.["*"])"'
Random Article
# Random article summary (needs -L to follow redirect)
curl -sL "https://en.wikipedia.org/api/rest_v1/page/random/summary" \
| jq '{title, description, extract: .extract[0:200]}'
On This Day
# Events on today's date
curl -s "https://en.wikipedia.org/api/rest_v1/feed/onthisday/events/$(date +%m)/$(date +%d)" \
| jq '.events[:5] | .[] | {year, text}'
Glossary Builder
# Build a security glossary in markdown
for term in "OAuth" "SAML" "LDAP" "RADIUS" "Kerberos" "HMAC" "TLS" "802.1X" "IPsec" "PKI"; do
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/${term}" \
| jq -r '"## \(.title)\n\(.description // "")\n\n\(.extract[0:300])...\n"'
done
# Security protocol comparison table
for term in "OAuth" "SAML" "Kerberos" "RADIUS"; do
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/${term}" \
| jq -r '"\(.title)\t\(.description // "—")"'
done | column -t -s$'\t'