← All one-liners·#021·analysis·self contained·power

Wikipedia page views over time

Track real-world attention on any topic — daily views for any Wikipedia article, going back to 2015. Wikimedia's REST API, no key.

The one-liner
$ curl -s "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/user/ChatGPT/daily/20250101/20251231" \
  | jq -r '.items[] | "\(.timestamp[0:8])\t\(.views)"' \
  | tail -30
What each stage does
  1. [01] curlcurl … /pageviews/per-article/en.wikipedia/all-access/user/ChatGPT/daily/2025010…
    Path encodes: lang.project · access type · agent type · article · granularity · YYYYMMDD start · YYYYMMDD end. The article slug uses underscores; URL-encode special chars.
  2. [02] jqjq -r '.items[] | "\(.timestamp[0:8])\t\(.views)"'
    Slice the YYYYMMDDHH timestamp to the date prefix, emit a date↹views TSV — ready for `gnuplot`, DuckDB, or just `awk`.
  3. [03] tailtail -30
    Last 30 days. Pipe into `mlr --t2c cat` to convert to CSV, or `awk '{print $1, $2/1000"k"}'` for compact display.
Expected output (sample)
20251202	187423
20251203	201118
20251204	195630
... 27 more lines
Caveats & tips
  • Wikipedia rate-limits anonymous traffic to ~100 req/sec — fine for any sensible script.
  • Pipe through `mlr --t2c stats1 -a sum -f views` to get the period total in one line.