diff --git a/.github/scripts/accumulate-traffic.py b/.github/scripts/accumulate-traffic.py index 13525f8..fbf5eaa 100644 --- a/.github/scripts/accumulate-traffic.py +++ b/.github/scripts/accumulate-traffic.py @@ -19,6 +19,13 @@ TRAFFIC_DIR = f"traffic-{REPO_SLUG}" HISTORY_REFERRERS = "traffic_referrers_history.json" HISTORY_PATHS = "traffic_paths_history.json" HISTORY_STARS = "traffic_stars_history.json" +HISTORY_TRENDING = "traffic_trending_history.json" + +# One-time backfill of github.com/trending history, scraped from Trendshift +# (trendshift.io/repositories/14577) which retained it before this tracker +# existed. Used only to seed the very first run; after that the accumulated +# branch history is authoritative and this is never consulted again. +TRENDING_SEED = [{"date":"2025-08-13","javascript":5},{"date":"2025-08-14","javascript":2},{"date":"2025-08-15","javascript":14},{"date":"2025-08-16","javascript":8},{"date":"2025-08-17","javascript":2},{"date":"2025-08-24","javascript":6},{"date":"2025-08-25","javascript":2,"all":10},{"date":"2025-08-26","all":1,"javascript":1},{"date":"2025-08-27","all":1,"javascript":1},{"date":"2025-08-28","all":1,"javascript":1},{"date":"2025-08-29","all":11,"javascript":1},{"date":"2025-09-16","javascript":2},{"date":"2025-09-24","javascript":6},{"date":"2025-10-04","javascript":5},{"date":"2025-10-13","javascript":1,"all":4},{"date":"2025-10-14","javascript":1,"all":6},{"date":"2025-10-15","javascript":1},{"date":"2025-10-16","javascript":15},{"date":"2025-10-26","javascript":12},{"date":"2026-01-27","javascript":1},{"date":"2026-01-28","javascript":1,"all":3},{"date":"2026-01-29","javascript":1,"all":2},{"date":"2026-01-30","javascript":1,"all":2},{"date":"2026-01-31","javascript":2},{"date":"2026-04-02","all":3},{"date":"2026-06-11","javascript":9},{"date":"2026-06-12","javascript":2},{"date":"2026-06-13","javascript":1},{"date":"2026-06-14","javascript":1},{"date":"2026-06-15","javascript":3},{"date":"2026-06-16","javascript":6},{"date":"2026-06-17","javascript":4},{"date":"2026-06-18","javascript":2},{"date":"2026-06-19","javascript":9},{"date":"2026-06-20","javascript":5},{"date":"2026-06-21","javascript":1,"all":16},{"date":"2026-06-22","javascript":3},{"date":"2026-06-23","javascript":2},{"date":"2026-07-04","all":7,"javascript":3},{"date":"2026-07-05","all":3,"javascript":2},{"date":"2026-07-06","all":1,"javascript":1}] def load_json(path): try: @@ -155,7 +162,64 @@ def accumulate_stars(publish_dir): print(f"Accumulated: {len(star_history)} star snapshots (latest={star_history[-1]['stars'] if star_history else 'n/a'})") return star_history, fetch_star_windows() -def build_dashboard(publish_dir, ref_history, path_history, star_history, star_windows): +def fetch_trending_rank(url): + """Rank of this repo on a github.com/trending page (1-based article + position), or None if not listed / fetch failed. Trending has no API, + but the page is server-rendered HTML: one
Drag to zoom — click Reset to restore
Bars show stars gained per day · drag to zoom
Page Trends — daily 14-day view count for the top pages