Last checked

How to search GitHub repositories and export stars, forks and topics

Unofficial tool. Not affiliated with, endorsed by, or sponsored by GitHub, Inc.

GitHub has a public REST API for repository search. It takes the same query you would type into GitHub’s search box and returns repositories with their star, fork and language counts. That is enough to build a list of repos to compare, track or analyze. Two limits shape everything: GitHub returns at most 1,000 results per query, and without a token it allows only about 10 search requests per minute.

In short

  1. Write the query: keywords plus qualifiers such as language:JavaScript, stars:>=50 or pushed:>=2026-01-01.
  2. GET https://api.github.com/search/repositories?q={query}&sort=stars&order=desc.
  3. Keep the repository fields you need and leave owner profile data out.
  4. If the search has more than 1,000 matches, split it by date or star range.

Call the search API yourself

import json
from urllib.parse import urlencode
from urllib.request import Request, urlopen

query = "web scraper language:JavaScript stars:>=50 pushed:>=2026-01-01"
url = "https://api.github.com/search/repositories?" + urlencode(
    {"q": query, "sort": "stars", "order": "desc", "per_page": 10}
)
request = Request(url, headers={
    "Accept": "application/vnd.github+json",
    "User-Agent": "LepidataGuide/1.0 (+https://lepidata.com)",
})
with urlopen(request, timeout=30) as response:
    data = json.load(response)

for repo in data["items"]:
    print(repo["full_name"], repo["stargazers_count"], repo["forks_count"], repo["language"])

To send a token, add an Authorization: Bearer <token> header. A token with no scopes is enough for public search. Keep it in an environment variable, not in your code.

Limits to plan for

  • 1,000 results per query. GitHub stops there however many repos match. To get more, run the same search in slices, for example one created: month at a time or stars:50..99, stars:100..499 and so on.
  • About 10 searches a minute without a token, 30 with one. Each page of results is one search request. If you get a 403 or 429, wait for the reset time GitHub sends before you try again. Don’t rotate tokens to get around the limit.
  • Repository fields only. Search results include an owner object. GitHub’s Acceptable Use Policies restrict how personal information from GitHub can be used, so don’t build lists of people from it. Keep the owner’s login and type (User or Organization) if you need them, and nothing else.

When to stop writing this yourself

Pacing requests, waiting out rate limits, stopping cleanly at the 1,000 cap and flattening the response is where a short script grows. We built and publish a tool for this on Apify: the GitHub Repo Search Scraper. It takes a query plus optional filters (language, minimum stars, created and pushed dates, sort) and returns one row per repository. It is billed per repository returned. Status rows, such as no-results, rate-limited or search-cap, are free.

This Actor returns repository fields only. It does not collect emails, bios, followers or other personal profile data. Email addresses and phone numbers are removed from repo descriptions. No GitHub logos or marks are used.

Each row has fullName, name, ownerLogin, ownerType, url, description, stars, forks, watchers, openIssues, language, license (SPDX id), topics, createdAt, updatedAt, pushedAt, archived, fork and defaultBranch.

In our test on 26 October 2026, the input below returned 10 repositories in 0.886 seconds with one API call, without a token. Run again a few minutes later from the same IP, it hit GitHub’s unauthenticated search limit, waited 15 seconds, retried and finished normally.

{"query": "web scraper", "language": "JavaScript", "minStars": 50, "sort": "stars", "pushedFrom": "2026-01-01", "maxResults": 10}

Call it from code or an agent

The Actor is lepidata/github-repo-search. Keep your Apify token in an environment variable or a credential store, and send it in the Authorization header, never in a URL.

curl -s -X POST "https://api.apify.com/v2/acts/lepidata~github-repo-search/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"query": "web scraper", "language": "JavaScript", "minStars": 50, "sort": "stars", "maxResults": 10}'
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("lepidata/github-repo-search").call(run_input={"query": "web scraper", "language": "JavaScript", "minStars": 50, "sort": "stars", "maxResults": 10})
items = client.dataset(run["defaultDatasetId"]).list_items().items
repos = [row for row in items if row.get("type") == "repo"]

Input fields: query, language, minStars, sort (best-match, stars, forks, updated, help-wanted-issues), order (desc or asc), createdFrom / createdTo and pushedFrom / pushedTo (YYYY-MM-DD), includeArchived (default true), maxResults (up to 1,000, default 50) and an optional token. The token is a secret input. It is sent only to api.github.com and is never logged or saved in results. Without a token the Actor waits about 6.5 seconds between pages, and with one about 2 seconds. Apify Free-plan accounts get up to 100 results per run.

Written with AI assistance and checked by the Lepidata team.