شعار Wikimedia Pageviews

Wikimedia Pageviews

المجتمع
fuzheado
wikimedia-pageviews

Retrieve traffic and popularity statistics for Wikipedia articles via the Wikimedia pageviews/AQS REST API — top-pages ranking, per-article history, media requests, and why the old page_props popularity cache no longer works

نظرة عامة

الناشرfuzheado
المستودعWikipedia-AI-Skills
اسم المهارةwikimedia-pageviews
النجوم
27
التفريعات
10
الملفات المرفقة
5
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 5

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها fuzheado على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Wikimedia Pageviews في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-pageviews
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

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-pageviews .claude/skills/wikimedia-pageviews
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Wikimedia Pageviews في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Wikimedia Pageviews تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Wikimedia Pageviews بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

⚠️ User-Agent required: The REST API examples below require a descriptive User-Agent header. See the wikimedia-api-access skill for the correct format and rate-limiting patterns.

Enables the agent to retrieve traffic and popularity statistics for Wikipedia articles. Historical pageview logs are not stored in the SQL replicas, and the old page_props popularity cache (pageview_daily_average) is no longer populated — the API is the source of truth, and SQL is only for producing the candidate set to rank (see Scenario A).

SOP: Data Source Selection

Scenario A: Sorting/Filtering by General Popularity — no SQL path today

⚠️ The page_props popularity cache is retired. The property this skill used to recommend, pageview_daily_average, has 0 rows on enwiki, commons, dewiki, frwiki, nlwiki and wikidatawiki (verified 2026-09-20), and no pageview* property exists on any of them — while page_props itself is healthy (wikibase_item has 10.3M rows on enwiki). Queries filtering on it still parse, then return an empty result set: a silent wrong answer, not an error. (Tool:Popular Pages reads the PageviewAPI rather than writing a property.)

For "Top 100 most viewed pages in Category:Physics", the working shape is:

  1. Candidate set from SQL — category membership via categorylinks + linktarget (no popularity data needed).
  2. Rank with the API — AQS pageviews/per-article for a bounded set, the top endpoints for a site-wide ranking, or the popularpages reports. Batch and pace per the wikimedia-api-access skill.

The SQL shortcut below is kept as the pattern to use if a popularity property is restored; do not expect rows from it today.

  • Property Name (retired): pageview_daily_average
  • Table: page_props
  • Historical implementation:
sql
SELECT 
    p.page_title, 
    pp.pp_value AS avg_daily_views
FROM page p
JOIN page_props pp ON p.page_id = pp.pp_page
WHERE pp.pp_propname = 'pageview_daily_average'
  AND p.page_namespace = 0
ORDER BY CAST(pp.pp_value AS UNSIGNED) DESC
LIMIT 50;

Scenario B: Precise Historical Data (REST API)

If the task requires specific dates, trends, or "total views last month," the agent must use the Analytics QuickMetrics API.

Batch shortcut for known sets: if you need recent pageviews (rolling ~60 days) for a known set of articles, skip the per-article loop — the Action API prop=pageviews returns up to 50 titles per call. See references/pageview-api.md → "Batch: Action API prop=pageviews".

  • Endpoint: [https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/](https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/)
  • Access Pattern: project / access / agent / article / granularity / start / end
  • Implementation Pattern (Python):
python
import requests

def get_historical_views(article_title, start_date, end_date, project='en.wikipedia'):
    """
    article_title: Use underscores (e.g., 'Albert_Einstein')
    dates: 'YYYYMMDD' format
    """
    headers = {'User-Agent': 'Wiki Bot/1.0 (https://meta.wikimedia.org; your-email@example.com) WikiBot'}
    url = f"https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/{project}/all-access/all-agents/{article_title}/daily/{start_date}/{end_date}"
    
    response = requests.get(url, headers=headers, timeout=30)
    return response.json().get('items', []) if response.status_code == 200 else []

**Scenario C: Getting the Most Popular Pages (REST API Top Endpoint)

If the task requires finding the most-viewed pages across a project (e.g., "Top 100 most read articles on English Wikipedia"), use the Top Pages REST endpoint. This is much faster than querying per-article for thousands of pages.

  • Endpoint: https://wikimedia.org/api/rest_v1/metrics/pageviews/top/{project}/all-access/{date}
  • Date Format: YYYY/MM/DD with slashes (⚠️ different from the per-article endpoint which uses compact YYYYMMDD)
  • Data Lag: ~48 hours (use a date at least 2 days ago)
  • Title Format: Returns titles with underscores (e.g., Donald_Trump)
python
import requests
from datetime import datetime, timedelta

headers = {'User-Agent': 'MyBot/1.0 (me@example.com) ContentGapResearch'}
end = datetime.utcnow() - timedelta(days=3)
date_str = end.strftime('%Y/%m/%d')  # Slashes: 2026/05/25

url = f"https://wikimedia.org/api/rest_v1/metrics/pageviews/top/en.wikipedia/all-access/{date_str}"
resp = requests.get(url, headers=headers, timeout=30)
data = resp.json()
for article in data['items'][0]['articles'][:10]:
    print(f"{article['rank']}. {article['article']} — {article['views']} views")

Cross-API chaining: The Top Pages endpoint is often the first step in a pipeline that classifies popular articles by entity type. When chaining its output with the Action API (e.g., to resolve Wikidata IDs), normalize titles from underscores to spaces before looking up in Action API response dictionaries:

python
top_title = "Donald_Trump"  # from Pageviews Top
wikidata_id = action_api_dict.get(top_title.replace('_', ' '))  # ✅
# wikidata_id = action_api_dict.get(top_title)  # ❌ returns None

See the Batch Entity Classification SOP in the wikidata skill for the full pipeline, and the Title Format Guide in the wikimedia-api-access endpoint reference for the complete cross-API table.



Media Views (mediarequests) — image/file load counts

Pageview metrics count page loads; they do not count how often an image or media file was actually served. For the latter, use the Media Requests API (/metrics/mediarequests/):

  • Per-file time series (exists, tricky path): https://wikimedia.org/api/rest_v1/metrics/mediarequests/per-file/{referer}/{agent-type}/{file-path}/{granularity}/{start}/{end}
  • file-path is the upload path URL-encoded with the leading slash (/wikipedia/commons/0/00/Crab_Nebula.jpg -> %2Fwikipedia%2Fcommons%2F0%2F00%2FCrab_Nebula.jpg; omit the slash and you get 404 "invalid route"). referer is all-referers|internal|external|unknown or a project domain; agent-type is user|spider|all-agents; granularity is daily|monthly. (Corrected 2026-08-14: an earlier note claimed per-file was removed - that was a path-format error.)
  • ⚠️ agent-type=automated returns HTTP 400 on every mediarequests route (verified 2026-09-05: per-file and aggregate, all referer values). There is no automated bin in the data: all-agents = user + spider exactly (diff 0 — re-verified 2026-09-15), so automated clients' image requests are UA-counted as user — media "user" ≠ pageview "user". HTML-only fetchers request ~no images, but for any request-per-pageview ratio pair media-user with pageviews(user + automated), or you inflate by 1/(1 − automated share) on high-agent articles.
  • Per-day aggregate: https://wikimedia.org/api/rest_v1/metrics/mediarequests/top/{referer}/{media-type}/{year}/{month}/{day}
  • returns the day's top media files (file_path, requests, rank). media-type is one of all-media-types, image, video, audio, document, other; referer accepts all-referers or a project domain.
  • ⚠️ Only the top 1,000 files per day are returned. A long-tail file missing from that day's top-1000 has no API-accessible count — aggregate over several days if you need a range.
  • Description-page views ≠ media views. pageviews/per-article on a File: page counts views of the description page (typically a few dozen/day); media requests count every load of the underlying file (often thousands× more). Never use pageviews to answer "how many people viewed this image".
  • Pageviews ≠ media usage, generally. Pageviews count page loads, never media-file transfers/views. For "how many times was a file served" use the mediarequests AQS API (metrics/mediarequests/{aggregate,top,per-file}); for "where is it embedded" use GlobalUsage (prop=globalusage); for "off-wiki reuse" use the mediacounts referer_external field. Full method matrix + gotchas: wikimedia-commons skill → wikimedia-commons/references/media-usage-metrics.md.

Constraint & Guardrails

  1. The "No Table" Rule: The agent must never attempt to query a table named pageviews, traffic, or hits in the SQL replicas. They do not exist.
  2. SQL Casting (historical): when a page_props value is involved, pp_value is stored as a string (BLOB) — use CAST(pp_value AS UNSIGNED) to sort numerically. For pageview_daily_average this is moot: the property has no rows anywhere (see Scenario A).
  3. API Rate Limits: When fetching views for multiple pages, the agent should implement a small delay or use a single session object to avoid being throttled by the Wikimedia REST API.
  4. Title Formatting: SQL returns titles with underscores (e.g., Potomac,_Maryland). The Pageview API accepts these directly, but the agent should ensure no leading/trailing spaces exist.

Example Use Cases

  • SQL Cheat: "Find the 10 most popular articles about 'Software Engineering' based on daily averages."
  • API Precise: "How many views did the page '2024 Summer Olympics' get between July 1st and August 1st, 2024?"
  • Hybrid: "Identify the 'Top Importance' Medicine stubs and then use the API to find which one had the highest traffic spike last week."

Tooling

This skill includes helper scripts, reference docs, and templates:

🔧 Top Pages (scripts/top-pages.sh)

Fetch the most viewed articles for a Wikimedia project on a given date.

bash
./scripts/top-pages.sh [project] [date] [limit]

# Default: top 25 on en.wikipedia from 3 days ago
./scripts/top-pages.sh

# Top 50 on German Wikipedia
./scripts/top-pages.sh de.wikipedia 2026/05/20 50

# Top 10 on Commons
./scripts/top-pages.sh commons.wikimedia 2026/05/20 10

🔧 Per-Article Pageviews (scripts/per-article.sh)

Fetch historical daily pageviews for a specific article with a visual bar chart.

bash
./scripts/per-article.sh <article_title> [start_date] [end_date] [project]

# Last 7 days
./scripts/per-article.sh Albert_Einstein

# Custom date range
./scripts/per-article.sh "Python_(programming_language)" 20260101 20260301

# Different project
./scripts/per-article.sh Barack_Obama 20240101 20241231 en.wikipedia

📚 Pageview API Reference (references/pageview-api.md)

Full reference for the Wikimedia Pageviews REST API:

  • All endpoints (top, per-article, top-by-country, top-per-country)
  • Date format reference (slash vs compact — a common gotcha)
  • Common query patterns with examples
  • Error response guide

🐍 Analysis Template (assets/analysis-template.py)

A Python tool for fetching and analyzing pageview data:

bash
# Top N articles
python3 assets/analysis-template.py --top 10

# Analyze an article's trend (30 days by default)
python3 assets/analysis-template.py Albert_Einstein 90

# Compare desktop vs mobile vs app
python3 assets/analysis-template.py Albert_Einstein 30 --compare

# Detailed daily breakdown
python3 assets/analysis-template.py Albert_Einstein 14 --detailed

# Raw JSON output (for further processing)
python3 assets/analysis-template.py Albert_Einstein 7 --json

Features:

  • Trend analysis (up/down/stable) with daily change percentage
  • Peak/low detection
  • Access method comparison
  • JSON export mode

🧩 Sample SQL Queries (assets/example-queries.sql)

SQL queries for working with pageview data in the page_props table — ⚠️ they query the retired pageview_daily_average property (0 rows on six wikis, see Scenario A), so they return empty result sets. Kept as the pattern for a future popularity property; the file header repeats this.

  • Top pages by category
  • Overall most viewed
  • Pages without pageview data
  • Cross-reference views vs editor interest
  • Stubs with unexpectedly high traffic

Cross-References

Related SkillWhy
wikimedia-api-accessUser-Agent and API patterns for REST API calls
wikidataBatch entity classification pipeline — resolve article titles to QIDs
wikimedia-page-assessmentQuality and importance ratings — Popular_pages bot bridges pageviews and assessments
wikipedia-categoriesMost-viewed-in-category workflows

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Wikimedia Pageviews؟

Retrieve traffic and popularity statistics for Wikipedia articles via the Wikimedia pageviews/AQS REST API — top-pages ranking, per-article history, media requests, and why the old page_props popularity cache no longer works

لماذا تستخدم Wikimedia Pageviews على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Wikimedia Pageviews عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Wikimedia Pageviews في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-pageviews. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Wikimedia Pageviews؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Wikimedia Pageviews؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Wikimedia Pageviews معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Wikimedia Pageviews مجانية؟

نعم. نشرها fuzheado على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇