Logo di Wikimedia Url Shortener

Wikimedia Url Shortener

Community
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

Panoramica

Pubblicato dafuzheado
RepositoryWikipedia-AI-Skills
Nome della skillwikimedia-url-shortener
Stelle
27
Fork
10
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da fuzheado su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Wikimedia Url Shortener in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Wikimedia Url Shortener in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Wikimedia Url Shortener non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Wikimedia Url Shortener non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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.

Domande frequenti

Cosa fa la skill IA 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

Perché usare Wikimedia Url Shortener su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Wikimedia Url Shortener è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Wikimedia Url Shortener in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Wikimedia Url Shortener?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Wikimedia Url Shortener?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Wikimedia Url Shortener: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Wikimedia Url Shortener è gratuita?

Sì. È pubblicata su GitHub da fuzheado con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇