# GitHub Repo & Trending Scraper (official API) (`grit-77/github-repo-trending-scraper`) Actor

GitHub repositories scraper for public repository research. Export repository metadata as JSON, with optional contributor rows from the GitHub API.

- **URL**: https://apify.com/grit-77/github-repo-trending-scraper.md
- **Developed by:** [Grit](https://apify.com/grit-77) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Repo & Trending Scraper (official API)

GitHub repositories scraper returns public repository records and, when requested, contributor rows from the GitHub API.

GitHub repositories scraper uses the public source named below and writes its results to the Actor dataset.

### What you get

Fields vary by result type and optional enrichment. The examples below are from `sample_output.json`.

| Output field | Type | Example value or excerpt from saved sample |
|---|---|---|
| `record_type` | string | `"repo"` |
| `full_name` | string | `"KKKKhazix/AIHOT"` |
| `owner` | string | `"KKKKhazix"` |
| `name` | string | `"AIHOT"` |
| `url` | string | `"https://github.com/KKKKhazix/AIHOT"` |
| `description` | string or null | `"一个自己找热点、自己写日报的网站框架。把信源和精选标准换成你的，它就是你的行业热点站。"` |
| `homepage` | string or null | `"https://aihot.news"` |
| `language` | string | `"TypeScript"` |
| `stars` | integer | `5898` |
| `forks` | integer | `1493` |
| `watchers` | integer | `19` |
| `open_issues` | integer | `4` |
| `license` | string | `"MIT"` |
| `topics` | array | `["ai"]` |
| `default_branch` | string | `"main"` |
| `created_at` | string | `"2026-09-28T23:40:05Z"` |
| `updated_at` | string | `"2026-10-05T11:09:53Z"` |
| `pushed_at` | string | `"2026-10-04T23:27:49Z"` |
| `last_commit_date` | string | `"2026-10-04T23:27:47Z"` |
| `size_kb` | integer | `11077` |
| `archived` | boolean | `false` |
| `fork` | boolean | `false` |
| `languages` | object | `{"TypeScript": 3051659}` |
| `latest_release` | object or null | `{"tag": "v1.0.7"}` |
| `contributors_count` | integer | `10` |
| `readme_excerpt` | string | `"一个自己找热点、自己写日报的网站框架。 把信源换成你的，把精选标准换成你的 KnowHow，它就是你的行业热点站。 跑起来 · 改成你的行业 · 它是怎么工作的 · 文档 · 社区交流 这是什么 A…` |
| `mode` | string | `"trending"` |
| `error` | null | `null` |
| `repo` | string | `"KKKKhazix/AIHOT"` |
| `login` | string | `"KKKKhazix"` |
| `contributions` | integer | `38` |
| `profile_url` | string | `"https://github.com/KKKKhazix"` |
| `account_type` | string | `"User"` |

Three modes:

| Mode | What it does |
|---|---|
| `search` | GitHub repository search: text, language, topic, stars range, created / pushed dates, sort by stars, forks, updates or best match. |
| `repos` | Details for your list of `owner/repo` names or github.com URLs. |
| `trending` | **Trending-like**: repositories created in the last N days, sorted by stars. This is computed from the GitHub Search API. It is **not** GitHub's own trending page (which has no official API), so results differ from github.com/trending. |

Optional in every mode: top contributors as separate rows (login and contribution count only).

#### Repository row (`record_type: "repo"`)

| Field | Notes |
|---|---|
| `full_name`, `owner`, `name`, `url`, `homepage`, `description` | |
| `language`, `topics`, `license` (SPDX id), `default_branch`, `archived`, `fork`, `size_kb` | |
| `stars`, `forks`, `open_issues` | from the search/repo response |
| `watchers` | subscribers count; filled in `repos` mode or when `enrichSearchResults` is on |
| `created_at`, `updated_at`, `pushed_at` | |
| `last_commit_date` | newest commit on the default branch |
| `languages` | bytes per language |
| `latest_release` | `tag`, `name`, `published_at`, `prerelease`, `url` (null when the repo has no release) |
| `contributors_count` | including anonymous contributors |
| `readme_excerpt` | optional, plain text, length configurable |
| `mode`, `error`, `warnings` | `error` is set on failed rows; `warnings` lists optional fields that were skipped (for example by the rate limit) |

#### Contributor row (`record_type: "contributor"`)

`repo`, `login`, `contributions`, `profile_url`, `account_type`. No emails or other personal data.

### Input example

```json
{
  "mode": "search",
  "query": "web scraping",
  "language": "Python",
  "minStars": 1000,
  "pushedAfter": "2026-06-01",
  "sort": "stars",
  "maxItems": 50,
  "enrichSearchResults": true,
  "includeContributors": true,
  "maxContributorsPerRepo": 3
}
```

Repo details:

```json
{ "mode": "repos", "repositories": ["apify/crawlee", "https://github.com/psf/requests"], "includeReadme": true }
```

Trending-like, last 7 days, Rust:

```json
{ "mode": "trending", "trendingDays": 7, "language": "Rust", "maxItems": 25 }
```

### Output example

```json
{
  "record_type": "repo",
  "full_name": "KKKKhazix/AIHOT",
  "language": "TypeScript",
  "stars": 5898,
  "forks": 1493,
  "watchers": 19,
  "open_issues": 4,
  "license": "MIT",
  "created_at": "2026-09-28T23:40:05Z",
  "last_commit_date": "2026-10-04T23:27:47Z",
  "languages": {
    "TypeScript": 3051659,
    "CSS": 21311,
    "PLpgSQL": 3024,
    "Dockerfile": 1187
  },
  "latest_release": null,
  "contributors_count": 10,
  "mode": "trending",
  "error": null
}
```

A complete sample is in `sample_output.json`.

### GitHub token and rate limits (read this)

The token is optional. Without it GitHub allows **60 core API requests per hour and 10 search requests per minute per IP address**. A plain search row costs no extra request (stars, forks, license, topics and dates come with the search result). Each enriched repo costs up to 5 requests (languages, latest release, last commit, contributors count, plus watchers, README or contributors when selected), so roughly 10 enriched repos fit into the unauthenticated hour. When GitHub says the limit is hit, the run does not crash: it keeps what it already has, marks skipped optional fields in `warnings`, writes an error row naming the reset time and finishes with a status message.

With a personal access token (no scopes needed for public data) the limits are 5,000 requests per hour and 30 search requests per minute. Put it in the `githubToken` input, which is stored as a secret. It is sent only to `api.github.com`, and never logged or written to the dataset.

Other limits: GitHub search returns at most 1,000 results per query (the `maxItems` cap is 1,000), and contributor lists on very large repositories are what GitHub returns for the contributors endpoint.

### Pricing

Pay per event: **$0.0008 per repository row** (event `repo`) and **$0.0003 per contributor row** (event `contributor`). No start fee. Error rows are not charged. See `PRICING.md` for the comparison with other Store actors.

### Measured on a local run (with a token, 2026-10-05)

- 100 search rows, no enrichment: 3.5 s
- 50 search rows with languages, release, last commit, contributors count and watchers: 8.2 s
- 15 trending rows with README excerpt and 2 contributors each (40 rows): 3.3 s
- Unauthenticated, after the hourly quota was used: `repos` mode returned clear rate-limit error rows in 0.3 s

### FAQ

**What limits the result set?** `maxItems` caps repository rows, and the GitHub Search API also caps results for a query. Contributor rows are separate.

**Do I need a proxy or login?** No proxy or login is used. A GitHub token is optional for public data and gives authenticated API limits.

**How is it priced?** The proposed pay-per-event model charges `repo` per repository row and `contributor` per contributor row. Error rows have no custom event charge; no custom start event is proposed.

**What happens at GitHub rate limits?** The client reads GitHub rate-limit headers, waits for a nearby reset when allowed, or stops with a rate-limit warning. Enrichment uses extra API requests.

**How fresh are the fields?** Repository and contributor data is requested during the run. Source `updated_at` and `pushed_at` describe GitHub activity, not the Actor retrieval time.

**Is trending mode the GitHub Trending page?** No. It ranks recently created repositories by stars using the GitHub Search API.

### Use with AI agents / MCP

The actor takes a small JSON input and returns flat JSON rows, which suits tool calls. Through the Apify MCP server (`https://mcp.apify.com`) an agent can run it as a tool, for example "find Python repos created this month with more than 200 stars and show me their latest release" maps to `mode: trending` or `search` with `language`, `minStars` and `createdAfter`. Always pass `maxItems` so an agent run stays cheap, and give the agent a `githubToken` input if it will request enrichment for more than a handful of repos.

# Actor input Schema

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

search = GitHub repository search with filters. repos = details for a list of owner/repo. trending = repos created in the last N days sorted by stars, computed from the GitHub Search API (this is NOT the GitHub trending page, which has no official API).

## `query` (type: `string`):

Free-text search terms (mode search, optional in trending), e.g. `web scraping`. GitHub search syntax is allowed, e.g. `in:readme llm agent`.

## `repositories` (type: `array`):

owner/repo names or github.com URLs, e.g. `apify/crawlee` or `https://github.com/psf/requests`.

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

Primary language filter, e.g. `Python`, `TypeScript` (modes search and trending).

## `topic` (type: `string`):

Only repositories carrying this topic, e.g. `machine-learning`.

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

Keep repos with at least this many stars.

## `maxStars` (type: `integer`):

Keep repos with at most this many stars.

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

Date YYYY-MM-DD.

## `createdBefore` (type: `string`):

Date YYYY-MM-DD.

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

Date YYYY-MM-DD. Useful to drop abandoned repos.

## `pushedBefore` (type: `string`):

Date YYYY-MM-DD.

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

Sort order for search mode (trending always sorts by stars).

## `order` (type: `string`):

Sort direction for search mode.

## `trendingDays` (type: `integer`):

Mode trending: repositories created in the last N days, ranked by stars.

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

Hard cap on repository rows (the GitHub search API itself returns at most 1000 per query). Contributor rows are not counted here.

## `includeLanguages` (type: `boolean`):

Bytes per language. Costs 1 extra API call per repo.

## `includeLatestRelease` (type: `boolean`):

Tag, name and date of the latest release. 1 extra API call per repo.

## `includeLastCommit` (type: `boolean`):

Date of the newest commit on the default branch. 1 extra API call per repo.

## `includeContributorsCount` (type: `boolean`):

Number of contributors (anonymous included). 1 extra API call per repo.

## `includeReadme` (type: `boolean`):

First characters of the README as plain text. 1 extra API call per repo.

## `readmeChars` (type: `integer`):

Maximum characters kept from the README when the README excerpt is on.

## `enrichSearchResults` (type: `boolean`):

Search results already carry stars, forks, license, topics and dates. Turn this on to also fetch the optional extras above (languages, release, last commit, contributors count, README, watchers) for every search/trending row. Mode repos always enriches.

## `includeContributors` (type: `boolean`):

Emit one `contributor` row per top contributor (login and contribution count only, no emails). 1 extra API call per repo.

## `maxContributorsPerRepo` (type: `integer`):

How many top contributors to emit per repository when contributor rows are on.

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

A personal access token with no scopes is enough for public data. Without it GitHub allows only 60 core requests/hour and 10 search requests/minute per IP, so large runs stop early with a clear message. With it: 5,000/hour and 30 search requests/minute. The token is only sent to api.github.com and is never stored or logged.

## `maxConcurrency` (type: `integer`):

Parallel repositories processed at once. Keep low without a token.

## Actor input object example

```json
{
  "mode": "search",
  "query": "web scraping",
  "sort": "stars",
  "order": "desc",
  "trendingDays": 7,
  "maxItems": 50,
  "includeLanguages": true,
  "includeLatestRelease": true,
  "includeLastCommit": true,
  "includeContributorsCount": true,
  "includeReadme": false,
  "readmeChars": 500,
  "enrichSearchResults": false,
  "includeContributors": false,
  "maxContributorsPerRepo": 10,
  "maxConcurrency": 4
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with repository rows (record_type repo) and contributor rows (record_type contributor)

# 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 = {
    "query": "web scraping"
};

// Run the Actor and wait for it to finish
const run = await client.actor("grit-77/github-repo-trending-scraper").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 = { "query": "web scraping" }

# Run the Actor and wait for it to finish
run = client.actor("grit-77/github-repo-trending-scraper").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 '{
  "query": "web scraping"
}' |
apify call grit-77/github-repo-trending-scraper --silent --output-dataset

```

## MCP server setup

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

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/bihh9BKWEOmfO7MDx/builds/dEt2ffHTRX1NeouaI/openapi.json
