Skip to content

How to get GitHub trending repositories as JSON

By Hayden Barnett · · 6 min read

GitHub’s trending page is the list people mean by “what’s hot on GitHub this week.” The REST API documentation covers repositories, search, and activity. It does not document a trending resource (as of Nov 2026). The ranking is the HTML at github.com/trending.

You can still get that page as JSON. One GET returns the current list:

export FETCHPROOF_API_KEY=fp_live_xxx

curl -s "https://api.fetchproof.com/v1/github/trending/repositories?language=python&since=weekly" \
  --header "x-api-key: $FETCHPROOF_API_KEY"

language is optional. Pass the slug from the trending URL, such as python, javascript, or go, or leave it off for every language. since is daily (the default), weekly, or monthly. The body is one page: rank, full name, URL, description, language, star and fork totals, the stars gained in that range, and the accounts GitHub shows under “Built by”. The same key reads trending developers.

Why the usual stand-ins are a different list

Three approaches dominate the write-ups for this query, and each one answers a different question than the trending page.

Parsing the HTML yourself. The page is a run of article rows. Those class names are an implementation detail of the website, and they move. A scheduled job on a cloud IP also shares that address with every other client on the machine. When GitHub answers with a challenge page, a fragile parser often returns an empty list, the process exits 0, and the digest goes blank.

Repository Search. The long-standing substitute, including the accepted answer on how to get trending repositories from the GitHub API, is GET /search/repositories with qualifiers such as language:python, created:>YYYY-MM-DD or pushed:>YYYY-MM-DD, and sort=stars. That ranks repositories by how many stars they have in total, inside a created or pushed window. The trending page ranks by stars gained during the window, which is the line that reads “N stars today”, “N stars this week”, or “N stars this month”. A repository from years ago with a large gain this week is on the trending page, and it is absent from a search limited to repositories created this week. A repository created yesterday with a small star count can top that search and never appear on the trending page. Search has no qualifier for stars gained in a range, so it cannot reproduce the page.

A bare JSON array. The free proxy most often linked for this query returns a JSON array and nothing else. Its own note says that an empty trending page comes back as []. A caller that only checks for an array cannot separate that empty page from a fetch that failed and was replaced with nothing. Fetchproof uses the same envelope as every other call: success, credits_charged, and credits_remaining. An upstream failure is an error response. An empty page is a successful body whose repositories array is empty. Those two outcomes stay distinct.

What comes back

Field names and types below match the published schema for trending repositories. The names and counts are placeholders, so the sample does not claim any repository is trending today.

{
  "success": true,
  "credits_remaining": 99,
  "credits_charged": 1,
  "since": "weekly",
  "language": "python",
  "spoken_language_code": null,
  "repositories": [
    {
      "rank": 1,
      "owner": "<owner>",
      "repo": "<repo>",
      "full_name": "<owner>/<repo>",
      "url": "https://github.com/<owner>/<repo>",
      "description": "<description>",
      "language": "Python",
      "language_color": "#3572A5",
      "stars_count": 1200,
      "forks_count": 80,
      "stars_today": 340,
      "stars_today_text": "340 stars this week",
      "built_by": [
        {
          "username": "<username>",
          "avatar_url": "https://avatars.githubusercontent.com/u/0?s=40&v=4"
        }
      ]
    }
  ]
}

stars_today keeps that name on a weekly or monthly request. The number is the stars gained in the since range you sent, and stars_today_text is the label GitHub prints, such as 340 stars this week. Read the text, or branch on since, before you label a chart. Both fields are null when the row has no gained-stars line.

language and spoken_language_code at the top echo the query, or null when you omitted them. On a repository, description, language, and language_color are null when the page does not show them. built_by is the “Built by” avatars, each with username and avatar_url. full_name is owner/repo, and url is https://github.com/ plus that name.

There is no cursor. The trending page is a single screen, so a second call with the same parameters reads the list again. It is not a continuation.

The spoken-language dropdown on the page is a separate filter from the programming language. Add spoken_language_code. The published example is en:

curl -s "https://api.fetchproof.com/v1/github/trending/repositories?language=python&since=daily&spoken_language_code=en" \
  --header "x-api-key: $FETCHPROOF_API_KEY"

That parameter is on repositories only. Trending developers does not accept it.

A since value other than daily, weekly, or monthly never reaches GitHub. since=hourly is HTTP 400. The body has success: false, error: "invalid_parameter", and message: "since must be daily, weekly or monthly".

Python

The standard library is enough. Keep the key in the environment. The samples on this page use the placeholder fp_live_xxx.

import json
import os
import urllib.parse
import urllib.request

query = urllib.parse.urlencode({"language": "python", "since": "weekly"})
request = urllib.request.Request(
    "https://api.fetchproof.com/v1/github/trending/repositories?" + query,
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
with urllib.request.urlopen(request, timeout=60) as response:
    body = json.load(response)

for repo in body["repositories"]:
    print(f"{repo['rank']:>2}  {repo['stars_today_text']}  {repo['full_name']}")

urlopen raises if the status is not successful, which covers the 400 above. A 200 with an empty repositories array does not raise. Check the array, and read credits_charged, before you treat an empty morning as a fetch failure.

Node

Node 18 and later include fetch:

const response = await fetch(
  "https://api.fetchproof.com/v1/github/trending/repositories?language=javascript&since=daily",
  { headers: { "x-api-key": process.env.FETCHPROOF_API_KEY } },
);
if (!response.ok) {
  throw new Error(`GitHub trending failed: HTTP ${response.status}`);
}
const body = await response.json();
for (const repo of body.repositories) {
  console.log(repo.rank, repo.stars_today_text, repo.full_name);
}

The same x-api-key header is what the n8n HTTP Request post configures once. Point that node at /v1/github/trending/repositories and send language and since as query parameters. From an MCP client, the tool name is github_trending_repositories. Setup for the server is in the MCP docs.

The developers list takes language and since, and no spoken-language code:

curl -s "https://api.fetchproof.com/v1/github/trending/developers?language=go&since=monthly" \
  --header "x-api-key: $FETCHPROOF_API_KEY"

Each item has rank, username, name, url, avatar_url, and popular_repository. url is https://github.com/ plus username. popular_repository is the repository GitHub features beside that person: owner, repo, full_name, url, name, and description. It is null when the page does not feature one. name and that description are null when GitHub shows neither.

The list is enough for a digest. It does not include topics, the license, the default branch, or the last push time. Those are on the repository endpoint. Pass the url from a trending item. The call below uses the URL from that endpoint’s published example, so you can try the shape before you wire a loop:

curl -s "https://api.fetchproof.com/v1/github/repository?url=https%3A%2F%2Fgithub.com%2Ftorvalds%2Flinux" \
  --header "x-api-key: $FETCHPROOF_API_KEY"

The object under repository includes topics, license (key, name, spdx_id), default_branch, pushed_at, created_at, and updated_at, plus stars_count and forks_count. The endpoint page has the full field list.

What a call costs

Each of these three calls costs 1 credit by default. A weekly Python list, a monthly developers list, and one repository lookup are 3 credits if each one returns data. Errors, blocked or timed-out requests, invalid requests and cache hits cost nothing. A not-found or empty result is charged only where that operation’s published cost says so.

These operations publish that default and no separate empty or not-found price. An empty repositories array is still HTTP 200 with success: true. It is a successful read of an empty page, so the error rule does not apply to it. Read credits_charged on the body. The trending repositories page, the developers page, and the repository page each state the published cost. A bad since is an invalid request, and invalid requests cost nothing.

New accounts get 100 free credits, with no card. Pack sizes and prices are on the pricing page. How a prepaid pack compares with a monthly quota that resets is in prepaid credits vs monthly subscriptions. Every GitHub route sits on the GitHub API page.

FAQ

No, as of Nov 2026. The REST docs cover repositories, search, and activity. The trending lists are HTML pages. This endpoint is that public page as JSON. You do not create a GitHub OAuth app or send a GitHub token. The credential is the Fetchproof key in x-api-key.

Why is the field called stars_today on a weekly request?

It is the stars gained in the since range. On a weekly request, stars_today_text ends with “this week”. On a monthly request, it ends with “this month”. On a daily request, it ends with “today”. The property name stays stars_today in all three.

No. The page GitHub publishes is one screen, and the response has no continuation field. Call again with the same language and since when you want a fresh copy. The order and the membership both move as GitHub updates the page.

What if the language has no rows, or since is invalid?

Try it with 100 free credits

Sign up with an email address, no card. Credits never expire. Errors, invalid requests and cache hits cost 0 credits, and each endpoint page lists exactly what it charges.