Fetch real GitHub trending project data, supporting daily / weekly / monthly, filterable by programming language.
Quick Start
# 今日热门(默认)
python3 scripts/github_trending.py
# 本周热门,Top 25
python3 scripts/github_trending.py --period weekly --limit 25
# 本月热门,只看 Python 项目
python3 scripts/github_trending.py --period monthly --language python
# 输出 JSON(方便进一步处理)
python3 scripts/github_trending.py --period daily --json
Parameter Description
| Parameter | Short | Default | Description |
|---|---|---|---|
--period |
-p |
daily |
Time range:daily / weekly / monthly |
--limit |
-n |
20 |
Number of projects to return |
--language |
-l |
All | Programming language filter, e.g. python、go、rust |
--token |
-t |
Environment variable | GitHub PAT, can also set GITHUB_TOKEN |
--json |
— | No | Output raw JSON |
Increase API limit
Without a token, the GitHub API limit is 10 requests/minute; with a token it can be increased to 30 requests/minute.
export GITHUB_TOKEN=your_personal_access_token
python3 scripts/github_trending.py --period weekly
Implementation Notes
- No pip dependencies at all, using only the Python standard library
- Calls the
https://api.github.com/search/repositoriesreal API - Filter by
pushed:>=DATE stars:>=10+sort=starssort - Multilingual supplementation strategy: first fetch everything, then supplement by mainstream languages to ensure result diversity
FAQ
Q: Getting HTTP 403 / rate limit exceeded?
A: Set the GITHUB_TOKEN environment variable, or wait a moment and try again.
Q: Are the results not exactly the same as github.com/trending?
A: The official GitHub Trending page uses an internal algorithm; this script approximates it via the Search API based on recent stars growth. The results are highly consistent but not exactly identical.
Q: Which programming languages are supported?
A: All language identifiers supported by GitHub, such as python、javascript、typescript、go、rust、java、cpp、swift、kotlin , etc.