# Reddit Comments Scraper: Nested Threads & Markdown (`kizukidata/reddit-comments-scraper`) Actor

Extract nested Reddit comment trees as structured rows or LLM-ready Markdown from post URLs, share links, post IDs, or subreddits. Filter AMA replies, track only new comments, and skip charges on errors. Not affiliated with Reddit.

- **URL**: https://apify.com/kizukidata/reddit-comments-scraper.md
- **Developed by:** [Kizuki](https://apify.com/kizukidata) (community)
- **Categories:** Social media, News, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.32 / 1,000 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 Comments Scraper: Nested Threads & Markdown

Pass Reddit post URLs, share links (`/r/<sub>/s/...`), `redd.it` links, bare post IDs, or subreddits with keywords, and get nested comment trees as structured rows (`comments` mode) or whole discussions as LLM-ready Markdown (`threads` mode).

Turn on `onlyNewItems` on a schedule to collect and pay only for comments not returned by earlier runs. Empty input (`{}`) reads comments from sample post `1k2vnz0`. This Actor is an independent tool and is not affiliated with Reddit, Inc.

### What goes in and what comes out

| Input | What it returns |
|---|---|
| `postUrls` (full URL, `redd.it/<id>`, `/r/<sub>/s/...`, or ID) | Nested comments with `depth`, `parentId`, `isSubmitter`, `score`, `body`, and `bodyMarkdown` |
| `subreddits` + `queries` (optional) | Reads the newest 20 posts of each subreddit (only those matching `queries`, if given) and extracts their comment trees |
| `mode: "comments"` (default) | 1 row per comment, ordered by `commentSort` within each tree level |
| `mode: "threads"` | 1 row per post containing the nested `comments[]` list (up to `maxCommentsPerPost`) and indented `threadMarkdown` |
| `amaFilter` (`all`, `answered`, `unanswered`) | `answered` keeps each top-level comment thread (the root comment and all its replies) where the original poster replied; `unanswered` keeps the threads with no OP reply |

#### Quick start

Extract comments from a discussion sorted by top score:

```json
{
    "mode": "comments",
    "postUrls": ["https://www.reddit.com/r/SeveranceAppleTVPlus/comments/1k2vnz0/"],
    "commentSort": "top",
    "maxCommentsPerPost": 100,
    "maxItems": 100
}
```

Export whole threads as LLM-ready Markdown for RAG or summarization:

```json
{
    "mode": "threads",
    "postUrls": ["1k2vnz0"],
    "amaFilter": "answered",
    "maxCommentsPerPost": 500,
    "maxItems": 20
}
```

### Output fields

Every row includes `id`, `type` (`comment` or `thread`), `source`, `capturedAt`, and `error` (`null` on delivered rows).

#### Comment rows (`mode: "comments"`)

| Field | Description |
|---|---|
| `commentId`, `postId`, `parentId`, `depth` | Comment ID, parent post ID, parent fullname (`t3_...` or `t1_...`), and depth (`0` = top level; a reply whose parent is missing from the archive is also returned at `0` with its real `t1_` parent) |
| `subreddit`, `postTitle`, `postUrl`, `postAuthor` | Parent post context |
| `url`, `permalink` | Direct comment URL and permalink |
| `author`, `isSubmitter`, `distinguished`, `score` | Commenter username, OP flag, moderator/admin flag, and net score |
| `body`, `bodyMarkdown` | Plain text body and single-comment Markdown block with indentation and `[OP]` badge |
| `amaStatus` | `answered` if the root thread has an OP reply, otherwise `unanswered` |
| `createdAt`, `retrievedAt` | Comment creation time and when the archive indexed this comment (ISO 8601 UTC) |

#### Thread rows (`mode: "threads"`)

| Field | Description |
|---|---|
| `postId`, `url`, `subreddit`, `title`, `body`, `author`, `score`, `numComments` | Parent post metadata |
| `extractedCommentCount`, `comments[]` | Count and pre-order list of nested comment nodes (`id`, `parentId`, `depth`, `author`, `score`, `isSubmitter`, `body`, `repliesCount`) |
| `threadMarkdown`, `threadMarkdownTruncated` | The post and its indented comment hierarchy as Markdown, at most 60,000 characters. When comments do not fit, whole comments are left out from the end, the heading reads `Comments (k of N)`, and `threadMarkdownTruncated` is `true`. `comments[]` always has every extracted comment |

#### Output example (`mode: "comments"`)

```json
{
    "id": "c1001",
    "type": "comment",
    "source": "reddit",
    "commentId": "c1001",
    "postId": "1k2vnz0",
    "parentId": "t3_1k2vnz0",
    "depth": 0,
    "subreddit": "SeveranceAppleTVPlus",
    "postTitle": "Mark and Helly's relationship is kinda strange",
    "postUrl": "https://www.reddit.com/r/SeveranceAppleTVPlus/comments/1k2vnz0/mark_and_hellys_relationship_is_kinda_strange/",
    "postAuthor": "Antonater",
    "author": "commenter_one",
    "isSubmitter": false,
    "score": 48,
    "body": "I actually thought their shared rebellion built the bond fast.",
    "bodyMarkdown": "- **u/commenter_one** · score 48 · 2025-04-19 13:06Z (`c1001`)\n> I actually thought their shared rebellion built the bond fast.",
    "amaStatus": "answered",
    "error": null,
    "capturedAt": "2026-11-16T15:00:00.000Z"
}
```

### Data freshness and archive lag

Measurements taken on 2026-11-16 UTC:

- New comments: 28–66 s behind in 3 samples (`r/AskReddit` comments).
- New posts: the newest post per subreddit was 5–31 s behind across two 1,000-post runs (median 14 s).
- Vote scores: the archive first stores each comment and post with its score at that moment (often `score: 1`). Many are re-read 3–36 hours after creation, but some never are, so scores on recent or lightly active threads can stay at the first snapshot.

#### Removed and deleted posts

When posts are found by subreddit or keyword, posts that moderators, Reddit or the author removed or deleted are skipped, so the comment budget goes to threads people can still see (in a measured 1,000-post sample, 433 of 1,000 posts had been removed or deleted). Set `includeRemoved: true` to read them too. A post you name in `postUrls` is always read. Posts that AutoModerator held but whose text is still in the archive are kept, because many are approved later.

### Scheduled monitoring with `onlyNewItems`

Enable `onlyNewItems: true` to store delivered comment or thread IDs for 90 days. In `comments` mode, repeated runs return and charge only newly added comments on monitored threads. In `threads` mode a thread is remembered by its post ID and is not returned again. The memory is kept per mode, set of posts, subreddits and keywords (their order does not matter), `after`, `includeNsfw`, `includeRemoved`, `amaFilter`, `maxCommentsPerPost`, and `commentSort`; changing any of these starts a fresh memory. Avoid concurrent runs with the exact same input.

### Pricing and free tier

This Actor uses pay-per-event pricing, like the top Reddit Actors: a `comment` event for each comment (a comment row, or each comment inside a thread row) and a `post` event for the post part of a thread row. `apify-actor-start` is charged once per run start.

| Apify plan | Comment (per 1,000) | Post in a thread row (per 1,000) |
|---|---:|---:|
| Free | $0.60 | $0.80 |
| Starter (Bronze) | $0.52 | $0.80 |
| Scale (Silver) | $0.42 | $0.65 |
| Business (Gold) | $0.32 | $0.50 |

Example: a thread row with 100 comments is one post plus 100 comments, $0.0008 + 100 × $0.00052 = $0.0528 on Starter (Bronze).

Apify's Free plan includes USD 5 of monthly usage, which covers about 8,333 comments at the Free plan price (run start fees aside).

You are not charged when a post cannot be found or read on Reddit's side: the row says why in `error`, and these rows do not count toward `maxItems`. Invalid inputs and comments skipped by `onlyNewItems` are not charged either.

### Integrations and MCP

#### MCP (Claude, Cursor, n8n)

Add this Actor to any MCP client:

```text
https://mcp.apify.com?tools=fetch-actor-details,kizukidata/reddit-comments-scraper
```

- **Claude Code**: `claude mcp add --transport http apify "https://mcp.apify.com?tools=fetch-actor-details,kizukidata/reddit-comments-scraper"`
- **Cursor / Claude Desktop**: configure an HTTP MCP connector with the URL above and your Apify API token.

#### API (cURL / Python)

```bash
curl -X POST "https://api.apify.com/v2/acts/kizukidata~reddit-comments-scraper/runs?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"postUrls":["1k2vnz0"],"mode":"threads","maxItems":1}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("kizukidata/reddit-comments-scraper").call(run_input={
    "postUrls": ["1k2vnz0"],
    "mode": "comments",
    "maxItems": 50,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
```

### Related Kizuki Actors

- [Reddit Scraper](https://apify.com/kizukidata/reddit-scraper) — scrape posts by subreddit, author, or keyword, plus subreddit metadata and rules.
- [Bluesky Scraper](https://apify.com/kizukidata/bluesky-monitor) — keyword posts, account feeds, and follower growth snapshots via AT Protocol.
- [Telegram Channel Scraper](https://apify.com/kizukidata/telegram-channel-feed) — public Telegram channel posts with views, reactions, and `onlyNewItems` monitoring.
- [YouTube Transcript Scraper](https://apify.com/kizukidata/youtube-transcripts) — video subtitles, chapters, and replay heatmaps as Markdown and RAG chunks.
- [Reddit User & Subreddit Scraper](https://apify.com/kizukidata/reddit-user-subreddit-scraper) — the posts and comments of a user, plus profile rows, and the rules and newest posts of a subreddit.

# Actor input Schema

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

comments (default): 1 row/comment with depth, parentId, isSubmitter, bodyMarkdown. threads: 1 row/post with nested comments\[] and threadMarkdown (up to 60,000 characters).

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

Reddit post URLs, redd.it links, /r/{subreddit}/s/... share links, or post IDs (up to 50). Empty input reads sample post 1k2vnz0.

## `subreddits` (type: `array`):

Read the newest 20 posts of each subreddit (up to 50 subreddits) and extract their comment trees.

## `queries` (type: `array`):

Keywords (2-120 chars, up to 10) matched against post titles and text inside the listed subreddits. Without subreddits, searches up to 5 communities whose names start with the keyword. Not a Reddit-wide search.

## `commentSort` (type: `string`):

Order comments within each tree level: top (default), best, new, old, or controversial.

## `amaFilter` (type: `string`):

Filter top-level comment threads (root comment plus all replies) by OP replies: all (default), answered (OP replied somewhere in the thread), or unanswered (no OP reply).

## `maxCommentsPerPost` (type: `integer`):

Maximum comments extracted per post (0-2000; 0 = no per-post cap). Default 100.

## `after` (type: `string`):

For subreddit/keyword runs: oldest post boundary (YYYY-MM-DD, epoch seconds, or 24h/7d/30d).

## `before` (type: `string`):

For subreddit/keyword runs: newest post boundary (YYYY-MM-DD, epoch seconds, or 7d).

## `includeNsfw` (type: `boolean`):

Include posts marked NSFW (over_18) when discovering posts by subreddit/keyword.

## `includeRemoved` (type: `boolean`):

Also read comments under posts that moderators, Reddit or the author removed or deleted. Off by default: when posts are found by subreddit or keyword, removed and deleted posts are skipped, so the comment budget goes to threads people can still see. Posts you name in postUrls are always read.

## `onlyNewItems` (type: `boolean`):

true skips comments or threads delivered by prior runs with the same input (90-day state); false (default) returns all.

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

Max charged rows returned per run (1-5000, default 20). Status rows (error set) are free and do not count toward this cap.

## `proxyConfiguration` (type: `object`):

Proxy settings. Default uses no proxy. Residential proxies are not available.

## Actor input object example

```json
{
  "mode": "comments",
  "postUrls": [
    "https://www.reddit.com/r/SeveranceAppleTVPlus/comments/1k2vnz0/"
  ],
  "commentSort": "top",
  "amaFilter": "all",
  "maxCommentsPerPost": 100,
  "after": "",
  "before": "",
  "includeNsfw": false,
  "includeRemoved": false,
  "onlyNewItems": false,
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Reddit comments or Markdown threads returned by this run.

## `runSummary` (type: `string`):

Status code, counters and skipped input entries of this run.

# 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 = {
    "mode": "comments",
    "commentSort": "top",
    "amaFilter": "all",
    "maxCommentsPerPost": 100,
    "after": "",
    "before": "",
    "includeNsfw": false,
    "includeRemoved": false,
    "onlyNewItems": false,
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kizukidata/reddit-comments-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 = {
    "mode": "comments",
    "commentSort": "top",
    "amaFilter": "all",
    "maxCommentsPerPost": 100,
    "after": "",
    "before": "",
    "includeNsfw": False,
    "includeRemoved": False,
    "onlyNewItems": False,
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kizukidata/reddit-comments-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 '{
  "mode": "comments",
  "commentSort": "top",
  "amaFilter": "all",
  "maxCommentsPerPost": 100,
  "after": "",
  "before": "",
  "includeNsfw": false,
  "includeRemoved": false,
  "onlyNewItems": false,
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kizukidata/reddit-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kizukidata/reddit-comments-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/6Yrj3DbJeiUC80Sm1/builds/ks3KUIscAxoZqO7n2/openapi.json
