# GitHub Trending Repositories Scraper (`purethought/github-trending-scraper`) Actor

Scrapes GitHub Trending and returns repo name, owner, description, language, stars, forks, and stars gained today.

- **URL**: https://apify.com/purethought/github-trending-scraper.md
- **Developed by:** [Ganesh B](https://apify.com/purethought) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 50.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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 Trending Repositories Scraper

Scrapes the [GitHub Trending](https://github.com/trending) page and returns structured data on trending repositories, including star counts, fork counts, stars gained today, and programming language.

### What you get

- **repo**: Full repository name (`owner/repo`)
- **owner**: Repository owner
- **repoName**: Repository name without owner
- **description**: Repository description
- **language**: Primary programming language
- **stars**: Total number of stars
- **forks**: Total number of forks
- **starsToday**: Stars gained in the selected time range
- **url**: Full GitHub URL
- **since**: Time range filter used (daily/weekly/monthly)
- **scrapedAt**: ISO timestamp of when the data was fetched

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| language | String | (all) | Filter by programming language, e.g. `python`, `javascript`, `rust` |
| since | String | `daily` | Time range: `daily`, `weekly`, or `monthly` |
| maxItems | Integer | 25 | Maximum number of repositories to return (GitHub shows up to 25 per page) |

### Quick Start

1. Find the actor in [Apify Store](https://apify.com/purethought)
2. Click **Try for free** and set your inputs
3. Click **Start** and wait for the run to finish
4. Download results as JSON, CSV, or via the API

### Sample Output

Each item in the dataset looks like this:

```json
{
  "repo": "antirez/kilo",
  "owner": "antirez",
  "repoName": "kilo",
  "description": "A text editor in less than 1000 lines of code, written to explain how text editors work.",
  "language": "C",
  "stars": 7840,
  "forks": 712,
  "starsToday": 428,
  "url": "https://github.com/antirez/kilo",
  "since": "daily",
  "scrapedAt": "2024-11-01T10:00:00.000Z"
}
```

### Use cases

- Track trending open-source projects daily or weekly
- Build a developer newsletter with trending repos
- Analyze programming language popularity over time
- Monitor competitor or partner projects gaining traction
- Research emerging libraries and frameworks

### Notes

- GitHub Trending shows up to 25 repositories per page
- Set `language` to an empty string to get trending repos across all languages
- The `since` parameter accepts `daily`, `weekly`, or `monthly`
- Data is scraped directly from GitHub's public trending page — no API key required

# Actor input Schema

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

Filter by programming language, e.g. python, javascript. Leave empty for all languages.

## `since` (type: `string`):

Time range for trending: daily, weekly, or monthly.

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

Maximum number of repositories to return. GitHub Trending shows up to 25 per page.

## Actor input object example

```json
{
  "language": "",
  "since": "daily",
  "maxItems": 25
}
```

# Actor output Schema

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

Scraped GitHub trending repositories with name, stars, forks, language, and 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 = {
    "language": "",
    "since": "daily",
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("purethought/github-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 = {
    "language": "",
    "since": "daily",
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("purethought/github-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 '{
  "language": "",
  "since": "daily",
  "maxItems": 25
}' |
apify call purethought/github-trending-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,purethought/github-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/6uxfeDjhQJJ8DAhaE/builds/y0xhvImV0oaxsk7De/openapi.json
