buygithub.com · 我们的 star 交付方式 · 博客
追踪任意 GitHub 仓库的完整 star 历史。
增长模式、热门增速、多仓库对比、CSV 和 JSON 导出。
buygithub.com · GitHub star 究竟如何运作
为什么 star 历史很重要
GitHub 将 star 增速作为 Trending 页面、Explore 信息流和搜索排名的核心信号之一。一个 24 小时内获得 200 star 的仓库,比一个总数 10,000 star 但近期增长持平的仓库更容易获得曝光。
这个工具为你提供原始数据:每个 star 何时产生、来自谁、以什么速度增长。将你的项目与竞争对手对比,逐周追踪自身增长,理解驱动 GitHub 曝光的增速模式。
功能特性
| 功能 | 说明 |
|---|---|
| 完整历史 | 从最早到最新的每一条 star,带精确时间戳 |
| 增长分析 | 日、周、月、年增长率 |
| 峰值检测 | 识别最佳单日及其周边增速 |
| 多仓库对比 | 传入多个仓库,对比增长模式 |
| 增速报告 | 最近 30 天每日 star 增量,带可视化条形图 |
| 导出 | CSV 和 JSON 输出,用于分析或可视化 |
| 速率限制感知 | 触发 GitHub API 限制时自动退避重试 |
| Token 支持 | 可选 GitHub token,将每小时请求数从 60 提升至 5,000 |
快速开始
git clone https://github.com/Marcos66236/github-stars-history.git
cd github-stars-history
pip install -r requirements.txt
python star_history.py torvalds/linux
或作为软件包安装:
pip install -e .
star-history torvalds/linux
使用方法
单个仓库
python star_history.py facebook/react
Fetching stars history for facebook/react...
Total: 231,847 stars
Repository: facebook/react
Total stars: 231,847
Created: 2013-05-24
Age: 13 years, 3 months
Growth summary:
Last 7 days: +287 stars (41.0/day)
Last 30 days: +1,043 stars (34.8/day)
Last 365 days: +11,294 stars (30.9/day)
All time: +231,847 stars (47.8/day)
Peak day: 2023-10-05 (+2,341 stars)
Exported to facebook_react_stars.csv
对比多个仓库
python star_history.py facebook/react vuejs/vue sveltejs/svelte
增速报告
python examples/velocity_report.py facebook/react
在终端中以可视化条形图展示最近 30 天的每日 star 增量。
导出格式
# CSV(默认)
python star_history.py owner/repo --format csv
# 包含完整分析的 JSON
python star_history.py owner/repo --format json
# 仅显示摘要,不导出文件
python star_history.py owner/repo --summary
GitHub token
无 token:每小时 60 次请求。有 token:每小时 5,000 次请求。
export GITHUB_TOKEN=ghp_your_token_here
python star_history.py torvalds/linux
在 github.com/settings/tokens 生成 token。访问公共仓库无需特殊权限。
工作原理
GET /repos/{owner}/{repo}/stargazers
Accept: application/vnd.github.star+json
该接口返回每条带时间戳的 star 事件。本工具以每请求 100 条的方式分页遍历完整历史,通过自动退避处理速率限制,并重建完整的增长时间线。
Star 增速是 GitHub 计算 Trending 的主要信号之一。一天获得 50 star 的新项目,其相对增速高于拥有 50,000 star 的成熟项目一天增长 100。Trending 推荐的是增速异常加快的仓库,而不仅仅是总数高的仓库。
阅读完整分析:GitHub star 究竟是如何运作的
项目结构
github-stars-history/
├── star_history.py 主工具
├── setup.py 软件包配置
├── requirements.txt 依赖
├── examples/
│ ├── compare_frameworks.py 对比前端框架
│ └── velocity_report.py 30 天增速图表
├── tests/
│ └── test_star_history.py 单元测试
├── sample-output.json JSON 输出示例
├── CHANGELOG.md 版本历史
├── CONTRIBUTING.md 贡献指南
└── LICENSE MIT
运行测试
python -m pytest tests/
# 或者
python -m unittest tests/test_star_history.py
环境要求
- Python 3.8+
requests库
参与贡献
参见 CONTRIBUTING.md。
许可证
MIT。参见 LICENSE。
来自 buygithub.com 的相关资源
GitHub star 服务 · GitHub 粉丝 · 搜索排名 · 老账号 · 博客