# GitHub Repository Search & Trending Scraper (`chain_link/github-repo-search-trending`) Actor

Find GitHub repositories by keyword, language, topic and star count through the official REST Search API, or pull the Trending page. Each repo comes back as one clean record with stars, forks, topics, license and activity dates.

- **URL**: https://apify.com/chain_link/github-repo-search-trending.md
- **Developed by:** [James White](https://apify.com/chain_link) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 repository scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GitHub Repository Search & Trending Scraper

Find GitHub repositories by keyword, programming language, topic, star count and activity date, or grab what is trending on GitHub today, this week or this month. Every repository comes back as one clean, flat record with stars, forks, topics, license, homepage and activity dates, ready for a spreadsheet, a dashboard or your own database.

### What it does

The tool has two modes:

- **Search mode** uses GitHub's official, documented REST Search API. You fill in simple filters (keywords, language, topics, minimum stars, created/pushed after a date) and the tool turns them into a valid GitHub search query for you. You do not need to know GitHub's search syntax.
- **Trending mode** reads the public github.com/trending page, optionally for one language, for the daily, weekly or monthly period. You also get **starsInPeriod**, the number of stars a repository gained in that period. Each trending repository is then looked up in the official API to add topics, license, homepage, dates and the other details.

**Going past 1,000 results:** GitHub's search API returns at most 1,000 results per query. When you sort by **stars**, the tool narrows the star range step by step and keeps going until it reaches your Max items or runs out of matches. Duplicates are removed. With other sort orders, results stop at 1,000.

### Price

**$0.0005 per repository returned**, which is $0.50 per 1,000 repositories. You are only charged for repositories saved to your dataset, and the run never saves more than your **Max items**.

### Typical uses

- Spot fast-rising open-source projects in your language every day or week.
- Build lists of popular libraries in a niche, such as Python web scraping or Rust CLI tools.
- Market and competitor research on developer tools.
- Find actively maintained projects (pushed recently, not archived) to adopt or contribute to.
- Feed repository metadata into dashboards, newsletters or internal catalogues.

### Input

| Field | What it means |
|---|---|
| **Mode** (mode) | search to use the GitHub Search API, or trending to read the Trending page. Default: search. |
| **Search keywords** (searchQuery) | Free-text keywords, for example web scraping. Advanced users can also type raw GitHub search qualifiers here. Search mode only. |
| **Language** (language) | Programming language filter, for example python or typescript. Works in both modes. |
| **Topics** (topics) | A list of repository topics. A repository must have all of them. Search mode only. |
| **Minimum stars** (minStars) | Only repositories with at least this many stars. Search mode only. Default: 0. |
| **Created after** (createdAfter) | Date in YYYY-MM-DD format. Only repositories created after this date. Search mode only. |
| **Pushed after** (pushedAfter) | Date in YYYY-MM-DD format. Only repositories with code pushed after this date. Search mode only. |
| **Sort** (sort) | stars, forks, updated or best-match. Results are sorted from highest to lowest or newest to oldest. Search mode only. Default: stars. |
| **Trending period** (trendingSince) | daily, weekly or monthly. Trending mode only. Default: daily. |
| **GitHub token (optional)** (githubToken) | Your own GitHub personal access token. No scopes or permissions are needed. It raises GitHub's rate limits, which makes large searches faster and lets trending runs always include full details. The token is only sent to the GitHub API and is never stored in the results. |
| **Max items** (maxItems) | The maximum number of repositories to return. The input form fills in 100. If the field is left out entirely, 50 is used. |

If you leave every search filter empty, the tool searches all repositories with at least 1 star.

#### Example input

```json
{
  "mode": "search",
  "searchQuery": "web scraping",
  "language": "python",
  "minStars": 500,
  "sort": "stars",
  "maxItems": 10
}
```

Trending example:

```json
{
  "mode": "trending",
  "language": "python",
  "trendingSince": "weekly",
  "maxItems": 25
}
```

### Output

Each repository is one row with these fields:

| Field | Description |
|---|---|
| fullName | owner/repo identifier |
| name | Repository name |
| url | Repository URL on github.com |
| description | Repository description |
| language | Primary language |
| stars | Stargazer count |
| forks | Fork count |
| starsInPeriod | Stars gained in the trending period (trending mode only, otherwise null) |
| openIssues | Open issues count as reported by GitHub (GitHub counts open pull requests here too) |
| topics | List of repository topics |
| license | SPDX license id, such as MIT or Apache-2.0 |
| homepage | Project homepage URL |
| defaultBranch | Default branch name |
| isFork | Whether the repository is a fork |
| archived | Whether the repository is archived |
| createdAt | Creation timestamp (ISO 8601) |
| pushedAt | Last push timestamp (ISO 8601) |
| source | search or trending |
| scrapedAt | When the record was collected (ISO 8601) |

Fields GitHub does not provide for a repository are returned as null.

#### Example output row

```json
{
  "fullName": "codecrafters-io/build-your-own-x",
  "name": "build-your-own-x",
  "url": "https://github.com/codecrafters-io/build-your-own-x",
  "description": "Master programming by recreating your favorite technologies from scratch.",
  "language": "Markdown",
  "stars": 561163,
  "forks": 52511,
  "starsInPeriod": null,
  "openIssues": 692,
  "topics": ["awesome-list", "free", "programming", "tutorial-code", "tutorial-exercises", "tutorials"],
  "license": null,
  "homepage": "https://codecrafters.io",
  "defaultBranch": "master",
  "isFork": false,
  "archived": false,
  "createdAt": "2018-05-09T12:03:18Z",
  "pushedAt": "2026-11-08T16:38:15Z",
  "source": "search",
  "scrapedAt": "2026-11-09T07:10:00.000000+00:00"
}
```

### Limits

- **Search speed:** without a token, GitHub allows about 10 search requests per minute (up to 100 repositories each). The tool respects GitHub's rate-limit headers and pauses until the limit resets, so large searches without a token take a few minutes. With a token the limit is about 30 per minute.
- **1,000-result cap:** GitHub returns at most 1,000 results per query. The tool goes beyond this only when sorting by stars, as explained above. If you type your own stars: qualifier into the keywords, this extension is switched off.
- **Trending:** GitHub's Trending page lists about 25 repositories per language and period, so trending runs return at most that many.
- **Trending details:** extra details for trending repositories come from the GitHub API, which allows 60 lookups per hour without a token. If that limit is reached, the remaining trending repositories are still returned, with stars, forks, description, language and starsInPeriod, but topics, license, dates and similar fields are null. Adding your own githubToken avoids this.
- **Access refused:** if GitHub refuses access or returns an unexpected page, the run logs a clear message and stops. It does not try to work around it.
- Only public repository metadata is collected. No user emails or personal profile data are collected.

### Terms and fair use

This tool reads public repository information through GitHub's official API and its public Trending page, and respects GitHub's rate limits. You are responsible for using the data in line with GitHub's Terms of Service and Acceptable Use Policies. Do not use it for spam, or to build or sell lists of personal information. If you provide a token, use your own and keep it private.

# Actor input Schema

## `mode` (type: `string`):

'search' uses the GitHub Search API; 'trending' scrapes github.com/trending.

## `searchQuery` (type: `string`):

Free-text keywords. You can also pass raw GitHub qualifiers (search mode).

## `language` (type: `string`):

Programming language filter, e.g. python, typescript. Applies to both modes.

## `topics` (type: `array`):

Repository topics; the repo must have all of them (search mode).

## `minStars` (type: `integer`):

Only repos with at least this many stars (search mode).

## `createdAfter` (type: `string`):

YYYY-MM-DD; only repos created after this date (search mode).

## `pushedAfter` (type: `string`):

YYYY-MM-DD; only repos with commits pushed after this date (search mode).

## `sort` (type: `string`):

One of stars, forks, updated, best-match (search mode).

## `trendingSince` (type: `string`):

One of daily, weekly, monthly (trending mode).

## `githubToken` (type: `string`):

Optional personal access token. It raises API rate limits; no scopes are needed.

## `maxItems` (type: `integer`):

Maximum number of repositories to return.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "",
  "language": "",
  "topics": [],
  "minStars": 0,
  "createdAfter": "",
  "pushedAfter": "",
  "sort": "stars",
  "trendingSince": "daily",
  "githubToken": "",
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "search",
    "searchQuery": "",
    "language": "",
    "topics": [],
    "minStars": 0,
    "createdAfter": "",
    "pushedAfter": "",
    "sort": "stars",
    "trendingSince": "daily",
    "githubToken": "",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("chain_link/github-repo-search-trending").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "search",
    "searchQuery": "",
    "language": "",
    "topics": [],
    "minStars": 0,
    "createdAfter": "",
    "pushedAfter": "",
    "sort": "stars",
    "trendingSince": "daily",
    "githubToken": "",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("chain_link/github-repo-search-trending").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "search",
  "searchQuery": "",
  "language": "",
  "topics": [],
  "minStars": 0,
  "createdAfter": "",
  "pushedAfter": "",
  "sort": "stars",
  "trendingSince": "daily",
  "githubToken": "",
  "maxItems": 100
}' |
apify call chain_link/github-repo-search-trending --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,chain_link/github-repo-search-trending"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HgJwVJt05FzYmldNV/builds/8SVkLesn1Ad81uees/openapi.json
