# GitHub Repository Scraper (`fresh_cliff/github-scraper`) Actor

This actor scrapes detailed information from GitHub repositories using reliable HTTP requests and HTML parsing. It extracts repository metadata including star counts, fork counts, topics/tags, license information, primary programming language, and last updated timestamps.

- **URL**: https://apify.com/fresh\_cliff/github-scraper.md
- **Developed by:** [Brennan Crawford](https://apify.com/fresh_cliff) (community)
- **Categories:** Developer tools, Agents, Automation
- **Stats:** 57 total users, 3 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## GitHub Repository Scraper for Apify

A Python-based Apify actor that scrapes GitHub repository information using requests and BeautifulSoup.

### Features
- Extracts repository information including:
  - Full name (owner/repo)
  - Star count
  - Description
  - Primary programming language
  - Topics/tags
  - Last updated time
  - License information
  - Fork count
- Written in Python using requests and BeautifulSoup for reliable scraping
- Built for the Apify platform

### Files
- `apify_actor.py` - The main actor code for Apify deployment
- `requests_github_scraper.py` - Standalone GitHub scraper (for local testing)
- `INPUT_SCHEMA.json` - Input schema for the Apify actor
- `requirements.txt` - Python dependencies
- `package.json` - Actor metadata for Apify

### Local Testing
1. Install dependencies: `pip install -r requirements.txt`
2. Run the local version: `python requests_github_scraper.py`
3. Check results in the `apify_storage` directory

### Deploying to Apify

#### Prerequisites
1. [Create an Apify account](https://console.apify.com/sign-up) if you don't have one
2. Install the Apify CLI: `npm install -g apify-cli`
3. Log in to your Apify account: `apify login`

#### Deployment Steps
1. Initialize your project folder (if you haven't already):
````

apify init github-scraper

````

2. Modify the `Dockerfile` to use Python:
```Dockerfile
FROM apify/actor-python:3.9

# Copy source code
COPY . ./

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Define how to run the actor
CMD ["python3", "apify_actor.py"]
````

3. Push your actor to Apify:
   ```
   apify push
   ```

4. After pushing, your actor will be available in the [Apify Console](https://console.apify.com/actors).

#### Running on Apify

1. Navigate to your actor in the Apify Console
2. Click on "Run" in the top-right corner
3. Enter the GitHub repository URLs you want to scrape in the Input form
4. Click "Run" to start the actor
5. Access the results in the "Dataset" tab once the run is complete

### Input Options

- `repoUrls` (required): Array of GitHub repository URLs to scrape
- `sleepBetweenRequests` (optional): Delay between requests in seconds (default: 3)

### Example Input

```json
{
  "repoUrls": [
    "https://github.com/microsoft/playwright",
    "https://github.com/facebook/react",
    "https://github.com/tensorflow/tensorflow"
  ],
  "sleepBetweenRequests": 5
}

```

### Output Format

The actor provides clean, well-structured data for each GitHub repository in the following format:

```json
{
  "url": "https://github.com/microsoft/playwright",
  "name": "playwright",
  "owner": "microsoft",
  "fullName": "microsoft/playwright",
  "description": "Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.",
  "stats": {
    "stars": "71.2k",
    "forks": "4k"
  },
  "language": "TypeScript",
  "topics": [
    "electron",
    "javascript",
    "testing",
    "firefox",
    "chrome",
    "automation",
    "web",
    "test",
    "chromium",
    "test-automation",
    "testing-tools",
    "webkit",
    "end-to-end-testing",
    "e2e-testing",
    "playwright"
  ],
  "lastUpdated": "2025-03-17T17:00:47Z",
  "license": "Apache-2.0 license"
}
```

#### Output Fields:

| Field | Type | Description |
|-------|------|-------------|
| `url` | String | The full URL of the GitHub repository |
| `name` | String | Repository name (without owner) |
| `owner` | String | Username or organization that owns the repository |
| `fullName` | String | Complete repository identifier (owner/name) |
| `description` | String | Repository description |
| `stats.stars` | String | Number of stars the repository has |
| `stats.forks` | String | Number of forks the repository has |
| `language` | String | Primary programming language |
| `topics` | Array | List of topics/tags associated with the repository |
| `lastUpdated` | String | ISO timestamp of the last update |
| `license` | String | Repository license information |

This structured output format makes it easy to:

- Display repository cards in your applications
- Create data visualizations
- Filter and sort repositories by various attributes
- Export to other data formats

# Actor input Schema

## `repoUrls` (type: `array`):

List of GitHub repository URLs to scrape

## `sleepBetweenRequests` (type: `integer`):

Random sleep interval between requests (in seconds) to avoid rate limiting

## Actor input object example

```json
{
  "repoUrls": [
    "https://github.com/microsoft/playwright",
    "https://github.com/apify/apify-js"
  ],
  "sleepBetweenRequests": 3
}
```

# 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 = {
    "repoUrls": [
        "https://github.com/microsoft/playwright",
        "https://github.com/apify/apify-js"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fresh_cliff/github-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 = { "repoUrls": [
        "https://github.com/microsoft/playwright",
        "https://github.com/apify/apify-js",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("fresh_cliff/github-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "repoUrls": [
    "https://github.com/microsoft/playwright",
    "https://github.com/apify/apify-js"
  ]
}' |
apify call fresh_cliff/github-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=fresh_cliff/github-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "GitHub Repository Scraper",
        "description": "This actor scrapes detailed information from GitHub repositories using reliable HTTP requests and HTML parsing. It extracts repository metadata including star counts, fork counts, topics/tags, license information, primary programming language, and last updated timestamps.",
        "version": "0.1",
        "x-build-id": "KszSzi8H76KL3eZRZ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/fresh_cliff~github-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-fresh_cliff-github-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/fresh_cliff~github-scraper/runs": {
            "post": {
                "operationId": "runs-sync-fresh_cliff-github-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/fresh_cliff~github-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-fresh_cliff-github-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "repoUrls"
                ],
                "properties": {
                    "repoUrls": {
                        "title": "Repository URLs",
                        "type": "array",
                        "description": "List of GitHub repository URLs to scrape",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sleepBetweenRequests": {
                        "title": "Sleep between requests (seconds)",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Random sleep interval between requests (in seconds) to avoid rate limiting",
                        "default": 3
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
