Logo Wikimedia Url Shortener

Wikimedia Url Shortener

Cộng đồng
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

Tổng quan

Nhà phát hànhfuzheado
Kho mãWikipedia-AI-Skills
Tên kỹ năngwikimedia-url-shortener
Sao
27
Bản fork
10
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được fuzheado công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Wikimedia Url Shortener trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Wikimedia Url Shortener trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Wikimedia Url Shortener ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Wikimedia Url Shortener với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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.

Câu hỏi thường gặp

Kỹ năng AI Wikimedia Url Shortener làm được gì?

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

Vì sao nên dùng Wikimedia Url Shortener trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Wikimedia Url Shortener là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Wikimedia Url Shortener trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Wikimedia Url Shortener?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Wikimedia Url Shortener với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Wikimedia Url Shortener với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Wikimedia Url Shortener có miễn phí không?

Có. Kỹ năng này được fuzheado phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇