# Reddit Comment Scraper (`muhammadafzal/reddit-comment-scraper`) Actor

Scrape public Reddit comments from post URLs for research, moderation analysis, content research, and AI-agent workflows. Returns comment text, author, score, timestamps, thread depth, parent IDs, permalinks, and post metadata; public endpoint access may be blocked by Reddit.

- **URL**: https://apify.com/muhammadafzal/reddit-comment-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 1,000 reddit comments

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

## Reddit Comment Scraper

**Free plan limit:** Free-plan users can receive up to **5 result records per run**. Paid-plan and local/unknown runs retain the Actor's existing limits.

Scrape public Reddit comments from one or more Reddit post URLs into clean, schema-validated dataset records for research, moderation analysis, content research, and AI-agent workflows.

### What it extracts

Each record contains the comment ID, post ID and title, subreddit, author, body, score, timestamps, parent ID, thread depth, permalink, stickied/distinguished flags, removal signal, and source JSON URL.

### Input

```json
{
  "postUrls": ["https://www.reddit.com/r/AskReddit/comments/abc123/title"],
  "maxComments": 100,
  "sort": "confidence",
  "includeReplies": true,
  "maxDepth": 10
}
```

The Actor accepts 1–20 public post URLs and returns at most 5,000 comments per run. It does not search comments globally, scrape private communities, use login cookies, or download linked media. Reddit may omit deleted, removed, collapsed, or inaccessible comments.

### Output example

```json
{
  "commentId": "c1abcde",
  "postId": "abc123",
  "postTitle": "What is a useful skill everyone should learn?",
  "subreddit": "AskReddit",
  "author": "example_user",
  "body": "A concise comment body.",
  "score": 42,
  "depth": 0,
  "parentId": "t3_abc123",
  "createdAt": "2026-01-01T12:00:00.000Z",
  "permalink": "https://www.reddit.com/r/AskReddit/comments/abc123/title/c1abcde/"
}
```

### Pricing

This Actor uses **pay-per-event** pricing. These are the current Apify Store event prices:

| Event | Price (USD) | When it is charged |
|---|---:|---|
| `apify-actor-start` | $0.00005 | Actor Start — Charged when the Actor starts running. Number of events charged depends on Actor memory (one event per GB, minimum one event). — Charged once per run. |
| `apify-default-dataset-item` | $0.002 | Reddit comment — One schema-valid public Reddit comment written to the default dataset. |

Apify platform usage for this Actor run is included alongside the event prices above; no separate per-run platform-usage fee is passed to users.

This covers Apify platform usage for this Actor run. Other Apify products or usage outside this Actor run may still follow your account plan.

### Reliability and failure modes

The Actor first uses Reddit’s public, page-owned JSON endpoint with bounded retries. After a classified 403, 429, timeout, or other direct access failure, it can use the owner-configured ScrapeCreators public Reddit post-comments endpoint. The provider key is stored as an Apify secret; no user cookies are required. Provider and direct records use the same dataset schema and PPE event. A blocked request with no provider result produces zero fabricated records and zero result events. A valid post with no visible comments is reported as `EMPTY`.

Use only public data and comply with Reddit’s current terms, developer policies, and applicable privacy law. Consider author names and comment text personal data; process and retain it only for a legitimate purpose.

# Changelog

This Actor's version history is a separate document: https://apify.com/muhammadafzal/reddit-comment-scraper/changelog.md

# Actor input Schema

## `postUrls` (type: `array`):

Use this when you want comments from one or more public Reddit posts. Enter full URLs such as https://www.reddit.com/r/AskReddit/comments/abc123/title; duplicates are removed. This is not a subreddit feed, user history, private community, or comment-search input.

## `maxComments` (type: `integer`):

Use this to cap total comments across all post URLs. Enter 1–5000; the default is 100. This limits returned comment records, not the number Reddit says exist and not deleted or hidden comments.

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

Use this when comment order matters. Choose confidence, top, new, controversial, old, or qa; the default is confidence. This changes Reddit's ordering and does not search comments across posts.

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

Use this when you need replies nested under comments. The default is true and preserves Reddit's returned thread depth; set false for top-level comments only.

## `maxDepth` (type: `integer`):

Use this to limit nested reply depth when includeReplies is true. Enter 0–10; the default is 10. A value of 0 returns top-level comments only and does not fetch morechildren separately.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.reddit.com/r/AskReddit/comments/abc123/title"
  ],
  "maxComments": 100,
  "sort": "new",
  "includeReplies": true,
  "maxDepth": 3
}
```

# Actor output Schema

## `comments` (type: `string`):

Schema-validated Reddit comment records.

## `summary` (type: `string`):

Status, record count, warnings, and estimated result-event cost.

# 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("muhammadafzal/reddit-comment-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("muhammadafzal/reddit-comment-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 muhammadafzal/reddit-comment-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/reddit-comment-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/D2hXpoQG2y6ZWgjUc/builds/rKT7xdifiuPyYsh0y/openapi.json
