# GitHub Discussions Scraper (`w3crawler/github-discussions-scraper`) Actor

Extracts public GitHub Discussions with titles, bodies, categories, authors, answer state, reactions, comments and replies from public repository pages.

- **URL**: https://apify.com/w3crawler/github-discussions-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 discussions

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### What does GitHub Discussions Scraper do?

**GitHub Discussions Scraper** collects public discussion pages from one or more [GitHub](https://github.com) repositories. It follows the public listing's next-page link, opens a bounded number of detail pages, and extracts discussion content, authors, categories, labels, answer state, timestamps, reactions, comments, and optional replies.

This is a public HTML scraper and API alternative for exporting discussion data. It does not log in, access private repositories, call undocumented private APIs, bypass challenges, or fabricate blocked/empty results. Requests are direct; proxy configuration is not supported or accepted.

### Why use GitHub Discussions Scraper?

Use it for community research, support-topic analysis, product-feedback discovery, and public repository monitoring. Listing pagination preserves the query and records the producing `searchUrl`, `pageNum`, and link `position`. Discussion URLs and discussion numbers are deduplicated across pages and repositories. Detail records have a stable `recordId` and `recordType=discussion`, while run-level failures remain in the `OUTPUT_SUMMARY` key-value artifact instead of polluting the dataset.

### What data can it extract?

| Group      | Fields                                                                                                      |
| ---------- | ----------------------------------------------------------------------------------------------------------- |
| Identity   | `recordType`, `recordId`, `repository`, `discussionNumber`, `discussionId`, `discussionUrl`                 |
| Content    | `title`, `body`, `authorLogin`, `authorUrl`, `state`, `isAnswered`, `categoryName`, `categoryUrl`, `labels` |
| Engagement | `commentCount`, `replyCount`, bounded `replies`, `reactions`, `reactionCount`                               |
| Provenance | `searchUrl`, `pageNum`, `position`, `sourceUrl`, `extractionMethod`, `accessStatus`, `scrapedAt`            |

### How to scrape GitHub Discussions

1. Open the Actor's **Input** tab.
2. Enter public `owner/repository` slugs or full GitHub repository URLs.
3. Optionally provide a GitHub `discussions_q` query.
4. Set per-repository discussion and listing-page limits, reply limits, and pacing.
5. Run the Actor and inspect normal rows plus `OUTPUT_SUMMARY` for pagination and errors.

### How much will it cost to scrape GitHub Discussions?

Cost depends on the Apify plan and compute used. Each listing page and detail page is a public HTTP request. More repositories, listing pages, detail records, replies, retries, and longer timeouts increase work. Sequential requests and bounded arrays keep runs predictable; `maxPagesPerRepository` limits listing coverage and `maxDiscussionsPerRepository` limits successful detail records per repository.

### Input

See the input tab for the complete configuration. The input is a JSON object.

#### Default smoke test

```json
{
  "repositories": ["community/community"],
  "query": "sort:date_created_desc",
  "maxDiscussionsPerRepository": 3,
  "maxPagesPerRepository": 2,
  "includeReplies": true,
  "maxReplies": 3,
  "requestDelayMs": 100,
  "timeoutSecs": 30,
  "maxRequestRetries": 1
}
```

#### Multiple repositories and no replies

```json
{
  "repositories": ["community/community", "octo/demo"],
  "query": "sort:date_created_desc",
  "maxDiscussionsPerRepository": 5,
  "maxPagesPerRepository": 2,
  "includeReplies": false,
  "maxReplies": 0
}
```

#### Conservative developer options

```json
{
  "repositories": ["community/community"],
  "maxDiscussionsPerRepository": 2,
  "maxPagesPerRepository": 1,
  "requestDelayMs": 500,
  "timeoutSecs": 30,
  "maxRequestRetries": 0
}
```

`repositories` is normalized to at most 20 unique valid public repository slugs. `query` defaults to `sort:date_created_desc` and is preserved on every listing page. `maxDiscussionsPerRepository` is 1–50 per repository; `maxPagesPerRepository` is 1–10 per repository; `maxReplies` is 0–100. `includeReplies=false` produces no `replies` array. Delay is 0–5000 ms, timeout is 5–120 seconds, and transient retries are 0–3. Unknown properties and invalid repository shapes are rejected.

### Output

#### Discussion record

```json
{
  "recordType": "discussion",
  "recordId": "github-discussion:example%2Fproject:42",
  "dataAvailable": true,
  "accessStatus": "public",
  "extractionMethod": "github_html",
  "detailStatus": "succeeded",
  "repository": "example/project",
  "discussionNumber": 42,
  "discussionId": "DI_42",
  "title": "How do I configure this?",
  "body": "A public question body.",
  "authorLogin": "octocat",
  "authorUrl": "https://github.com/octocat",
  "state": "Answered",
  "isAnswered": true,
  "categoryName": "Q&A",
  "labels": [
    {
      "name": "help",
      "url": "https://github.com/orgs/community/discussions?discussions_q=label%3Ahelp"
    }
  ],
  "commentCount": 2,
  "replyCount": 1,
  "replies": [
    {
      "body": "Use the documented configuration file.",
      "authorLogin": "maintainer",
      "createdAt": "2026-08-24T01:00:00.000Z",
      "reactions": []
    }
  ],
  "reactions": [{ "name": "upvote", "count": 2 }],
  "reactionCount": 2,
  "discussionUrl": "https://github.com/orgs/community/discussions/42",
  "sourceUrl": "https://github.com/orgs/community/discussions/42",
  "searchUrl": "https://github.com/orgs/community/discussions?discussions_q=sort%3Adate_created_desc&page=1",
  "pageNum": 1,
  "position": 1,
  "scrapedAt": "2026-08-24T00:00:00.000Z"
}
```

#### Run summary in `OUTPUT_SUMMARY`

```json
{
  "actorName": "github-discussions-scraper",
  "status": "SUCCEEDED",
  "dataAvailable": true,
  "repositories": ["example/project"],
  "query": "sort:date_created_desc",
  "maxDiscussionsPerRepository": 3,
  "maxPagesPerRepository": 2,
  "includeReplies": true,
  "maxReplies": 3,
  "listPagesFetched": 1,
  "discussionsDiscovered": 3,
  "detailPagesFetched": 3,
  "recordsStored": 3,
  "duplicatesSkipped": 0,
  "sourceBlocked": false,
  "errorCount": 0,
  "errors": [],
  "scrapedAt": "2026-08-24T00:00:00.000Z"
}
```

When a listing or detail page fails, `status` becomes `PARTIAL` if usable records remain, or `BLOCKED_OR_EMPTY` if none do. The summary includes bounded error entries with stage, page, URL, block classification, and message. Diagnostics are never represented as normal discussions.

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Tips and advanced options

Use a small `maxPagesPerRepository` for a quick run and increase it only when you need older discussions. `maxDiscussionsPerRepository` counts successful detail records, so a failed detail page does not become a placeholder. The Actor follows only observed public pagination links, stops on repeated/no-progress pages, and keeps `includeReplies` and `maxReplies` independent of the page-reported comment count.

### FAQ, support, and responsible use

If the dataset is empty, inspect `OUTPUT_SUMMARY` for `sourceBlocked`, `errorCount`, and the per-stage errors. The API tab exposes the dataset and summary; for support, include the Apify run ID and summary in the Issues tab. Do not treat a blocked or empty result as evidence that a repository has no discussions.

Use public data lawfully and follow GitHub's terms, rate limits, robots guidance where applicable, and all privacy/data-protection laws. Public discussions may contain personal data; do not use this Actor to bypass access controls or collect private information. This Actor is not affiliated with GitHub.

### Local validation

```bash
npm ci
npm run check
npm test
apify validate-schema
apify run --purge --input-file test/inputs/live-smoke.json
npm run validate
```

# Actor input Schema

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

Owner/repository slugs or full public GitHub URLs, such as community/community.

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

GitHub discussions\_q expression. The default sorts by newest created discussions.

## `maxDiscussionsPerRepository` (type: `integer`):

Bound detail-page requests and emitted records per repository.

## `maxPagesPerRepository` (type: `integer`):

Maximum public discussion listing pages to inspect per repository. Pagination follows GitHub's next-page link and preserves the query.

## `includeReplies` (type: `boolean`):

Include parsed reply bodies, authors and timestamps in each record.

## `maxReplies` (type: `integer`):

Bound the nested reply array while retaining the page-reported comment count.

## `requestDelayMs` (type: `integer`):

Milliseconds to wait between sequential public GitHub detail pages.

## `timeoutSecs` (type: `integer`):

Timeout applied to each public listing or detail request.

## `maxRequestRetries` (type: `integer`):

Bounded retries for timeouts and transient HTTP statuses (408, 429, and 5xx). Access blocks are not retried indefinitely.

## Actor input object example

```json
{
  "repositories": [
    "community/community"
  ],
  "query": "sort:date_created_desc",
  "maxDiscussionsPerRepository": 5,
  "maxPagesPerRepository": 2,
  "includeReplies": true,
  "maxReplies": 20,
  "requestDelayMs": 250,
  "timeoutSecs": 30,
  "maxRequestRetries": 1
}
```

# Actor output Schema

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

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/github-discussions-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/github-discussions-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 '{}' |
apify call w3crawler/github-discussions-scraper --silent --output-dataset

```

## MCP server setup

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