Logo: Wikimedia Url Shortener

Wikimedia Url Shortener

Communautéit
fuzheado
wikimedia-url-shortener

Create and expand w.wiki short URLs (Wikimedia's URL shortener) — redirect behavior, the missing expansion API, the browser CORS trap, server-side resolution patterns, and creation via the meta.wikimedia.org API

Iwwersiicht

Editeurfuzheado
RepositoryWikipedia-AI-Skills
Skill-Nummwikimedia-url-shortener
Stären
27
Forks
10
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    fuzheado huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Wikimedia Url Shortener an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fuzheado/Wikipedia-AI-Skills.git /tmp/Wikipedia-AI-Skills
mkdir -p .claude/skills
cp -r /tmp/Wikipedia-AI-Skills/.claude/skills/wikimedia-url-shortener .claude/skills/wikimedia-url-shortener
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Wikimedia Url Shortener an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Wikimedia Url Shortener automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Wikimedia Url Shortener net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Wikimedia URL Shortener (w.wiki)

⚠️ User-Agent required: All requests to w.wiki and meta.wikimedia.org need a descriptive User-Agent. See the wikimedia-api-access skill.

What It Is

w.wiki is the Wikimedia Foundation's URL shortener, built on the Extension:UrlShortener extension. Short URLs look like https://w.wiki/TR9R (or bare w.wiki/TR9R) and 301-redirect to the target URL.

  • Create short URLs at https://meta.wikimedia.org/wiki/Special:UrlShortener or via the API (below). Requires edit rights on Meta-Wiki.
  • Expand a short URL: there is no expansion API (see Gotcha 1) — the only way is to follow the redirect.
  • QR code for any URL: https://meta.wikimedia.org/wiki/Special:QrCode?url=<url> (302s to a PNG).

Quick Reference

TaskMethod
Expand a short URL (server-side)curl -sI https://w.wiki/CODE → read location: header (or curl -sL to follow)
Expand in Nodeawait fetch(url) — resp.url is the final target after redirects
Expand in Pythonrequests.head(url, allow_redirects=True) → resp.url
Create (API)POST https://meta.wikimedia.org/w/api.php?action=shortenurl&url=...&format=json (auth required)
Create (UI)https://meta.wikimedia.org/wiki/Special:UrlShortener
QR codehttps://meta.wikimedia.org/wiki/Special:QrCode?url=<encoded>
Manage short URLshttps://meta.wikimedia.org/wiki/Special:ManageShortUrls

Verified Facts (2026-08-12)

  • https://w.wiki/TR9R → 301 → https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json.
  • The 301 response carries access-control-allow-origin: *, but the target page sends no CORS headers — see Gotcha 2 for why browser-side expansion fails.
  • No API on w.wiki itself: https://w.wiki/api.php?... is treated as a short code and returns an HTML "Wikimedia Error / Short URL Not Found" page. The action=shortenurl API module lives on meta.wikimedia.org (verified via action=paraminfo&modules=shortenurl), not w.wiki.
  • shortenurl params: url (required, string), qrcode (boolean).
  • Rate limits (per meta.wikimedia.org/wiki/Wikimedia_URL_Shortener): 10 creations / 2 minutes for IPs, 50 / 2 minutes for logged-in users.
  • Special:UrlShortener (HTTP 200) and Special:QrCode?url=... (HTTP 302 → QR PNG) both exist on meta.

Gotchas (don't rediscover these)

  1. There is no way to "look up" a w.wiki code without following the redirect. No expansion endpoint exists — not on w.wiki, not in the API. The extension docs mention action=shortenurl (creation only). Expand by following the redirect and reading the final URL.

  2. Browsers cannot expand w.wiki links to wiki pages. fetch('https://w.wiki/CODE') in a browser fails with TypeError: Failed to fetch: the browser follows the 301 (whose own response is CORS-permitted), then the target page (e.g. commons.wikimedia.org) sends no CORS headers, so the final response is blocked. redirect: 'manual' gives an opaque response with no readable Location header. Fix: expand server-side (curl / Node / Python), or add a same-origin resolver endpoint to your own server that follows the redirect and returns the final URL as JSON (see deploy/server.js /api/resolve in the WikiBento project for a working Node 20 zero-dependency implementation).

  3. w.wiki is not a MediaWiki API surface. Anything under w.wiki/ is interpreted as a short code — api.php, w/, etc. all 404 with "Short URL Not Found". Route API calls to meta.wikimedia.org instead.

  4. Creating short URLs requires authentication (edit rights on Meta-Wiki) and the action is a write op: use POST with a CSRF token (see wikimedia-auth-oauth). Anonymous POST returns a generic Wikimedia Error page, not JSON.

  5. Rate limits are per-user/IP and low (10/2 min anon). For bulk shortening, batch is not a thing here — pace requests or use the UI.

SOP 1: Expand a w.wiki Short URL

curl (read the Location header — no body fetched)

bash
curl -sI "https://w.wiki/TR9R" | grep -i '^location:'
# location: https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json

Node (browser-unavailable; server-side only)

javascript
const resp = await fetch('https://w.wiki/TR9R', { redirect: 'follow' });
console.log(resp.url); // final URL after redirects

Python

python
import requests
resp = requests.head('https://w.wiki/TR9R', allow_redirects=True, timeout=15)
print(resp.url)  # final URL after redirects

Browser (the CORS trap — needs a server-side helper)

A browser fetch() cannot read the target (Gotcha 2). Pattern that works: your own server exposes GET /api/resolve?url=<https-url>, follows the redirect server-side, and returns {"url": "<final>"}; the client then fetches the target through a CORS-enabled path (e.g. the MediaWiki Action API action=parse&prop=wikitext&origin=* for wiki pages). See the WikiBento src/lib/share.js + deploy/server.js for a tested reference implementation.

SOP 2: Create a Short URL (API)

Requires a logged-in session with edit rights on meta.wikimedia.org.

bash
# 1. Get a CSRF token
TOKEN=$(curl -s "https://meta.wikimedia.org/w/api.php?action=query&meta=tokens&type=csrf&format=json" \
  -b cookies.txt -A "$WIKIMEDIA_USER_AGENT" | python3 -c "import json,sys; print(json.load(sys.stdin)['query']['tokens']['csrftoken'])")

# 2. Shorten
curl -s -X POST "https://meta.wikimedia.org/w/api.php?action=shortenurl&format=json" \
  -b cookies.txt -A "$WIKIMEDIA_USER_AGENT" \
  --data-urlencode "url=https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json" \
  --data-urlencode "token=$TOKEN"
# → { "shortenurl": { "shorturl": "https://w.wiki/XXXX", ... } }

Pass qrcode=1 to also get QR code data in the response.

Use Cases

  • Shareable dashboard configs: https://wikibento.toolforge.org/?config=https://w.wiki/TR9R — short, phone-friendly URLs that survive QR scanning (WikiBento verified this end-to-end 2026-08-12).
  • QR codes for demos/GLAM events: Special:QrCode?url=... gives a PNG without any API call.
  • Link shorteners in templates/messages where full URLs bloat wikitext.

Heefeg gestallte Froen

Wat mécht de KI-Skill Wikimedia Url Shortener?

Create and expand w.wiki short URLs (Wikimedia's URL shortener) — redirect behavior, the missing expansion API, the browser CORS trap, server-side resolution patterns, and creation via the meta.wikimedia.org API

Firwat Wikimedia Url Shortener op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Wikimedia Url Shortener besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Wikimedia Url Shortener an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Wikimedia Url Shortener benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Wikimedia Url Shortener benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Wikimedia Url Shortener domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Wikimedia Url Shortener gratis?

Jo. fuzheado huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇