# Reddit Post Comments Scraper (`toolzerhub/reddit-post-comments-scraper`) Actor

Extract a Reddit post's full comment tree by sort mode: Best, New, Top, or Old. Get comment ID, post ID, author, creation date, score, upvotes, and full comment detail, plus collapsed reply threads on request. No Reddit account required.

- **URL**: https://apify.com/toolzerhub/reddit-post-comments-scraper.md
- **Developed by:** [ToolzerHub](https://apify.com/toolzerhub) (community)
- **Categories:** Social media, Automation, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Reddit Post Comments Scraper

Collect the comment tree under a Reddit post. Every row carries its `depth` and `parentId`, so you can rebuild the thread exactly as it appears on the page.

### Input

| Field | Use it for |
|---|---|
| **`post_id`** | Post ID or full permalink. Required. |
| **`sort_type`** | `CONFIDENCE` (default), `NEW`, `TOP` or `OLD`. |
| **`maxItems`** | Caps the run. Default `100`. Set `0` for no limit. |
| **`addonCommentReplies`** | Expand collapsed reply threads. Off by default. |

```json
{
  "post_id": "https://www.reddit.com/r/dataisbeautiful/comments/1uw2gep/some_slug/",
  "sort_type": "TOP",
  "maxItems": 500
}
```

### One request, one tree

Worth knowing up front: **this is a single request, not a pagination loop.** Reddit's comment response carries no top-level cursor -- there is nothing to page with. What you get is the comment tree Reddit serves for that post and sort order, which is deep but not infinite.

The only way further is `addonCommentReplies`, below.

### Output

One row per comment.

| Field | Contents |
|---|---|
| **`id`** | Comment ID |
| **`post_id`** | The post the comment belongs to |
| **`author`** | Username |
| **`created_at`** | Creation timestamp |
| **`score`** | Net score |
| **`upvotes`** | Upvote count, where reported separately |
| **`depth`** | Nesting level -- `0` is top-level |
| **`parentId`** | The comment or post this one replies to |
| **`comment_detail`** | Expanded reply payload. Only with **`addonCommentReplies`** |

Rows come back flat with a `depth` field rather than nested inside each other, which is what makes them straightforward to load into a table. Sort by the order they arrived and the thread reads top to bottom.

```json
{
  "id": "t1_ll9q2xk",
  "post_id": "t3_1uw2gep",
  "author": "transit_nerd",
  "created_at": "2026-07-14T10:44:02.000Z",
  "score": 1284,
  "depth": 0,
  "parentId": "t3_1uw2gep"
}
```

### Collapsed threads, and the "load more" markers

Reddit does not send every reply. Deep or heavily downvoted branches arrive as **"load more replies" markers** -- entries with no comment in them at all: no ID, no author, no body, just a cursor for fetching the rest.

By default those markers are **skipped**, and the run log tells you how many were dropped. Saving them would cost you a dataset row of nulls and a slot under `maxItems` for something that is not a comment.

Turn on **`addonCommentReplies`** and each marker is saved and expanded instead, with the fetched thread attached as `comment_detail`.

So: leave it off for the visible discussion, turn it on when you need the branches Reddit collapsed.

### Questions

**How do I rebuild the thread structure?**
Group on `parentId`. A comment whose `parentId` is the post's own ID (`t3_...`) is top-level; anything pointing at a `t1_...` ID is a reply to that comment. `depth` gives you the same information as a single number if you just want indentation.

**Why did I get fewer comments than the post shows?**
Because collapsed branches were not expanded, and because there is no pagination beyond the tree Reddit returns in one response. A post showing 900 comments will not yield 900 rows with the add-on off. The run log reports how many markers were skipped, which tells you how much is hiding.

**What does `sort_type` change?**
Which comments Reddit puts in the tree, and in what order. `CONFIDENCE` is Reddit's own default ranking. `NEW` and `OLD` are chronological and the most reproducible between runs; `TOP` re-ranks as votes move.

**Can I do several posts in one run?**
No, one post per run. Get IDs from the [Subreddit Posts Scraper](https://apify.com/toolzerhub/reddit-subreddit-posts-scraper) and run this once per post.

### Related Actors

| Actor | Purpose |
|---|---|
| [Reddit Post Scraper](https://apify.com/toolzerhub/reddit-post-scraper) | The post itself, batched cheaply for a whole list |
| [Reddit Subreddit Posts Scraper](https://apify.com/toolzerhub/reddit-subreddit-posts-scraper) | Find posts worth reading the comments of |
| [Reddit User Comments Scraper](https://apify.com/toolzerhub/reddit-user-comments-scraper) | One person's comments across all of Reddit |

# Actor input Schema

## `post_id` (type: `string`):

Reddit post ID (e.g. t3\_1uw2gep), or a full post permalink URL.

## `sort_type` (type: `string`):

Sort order for the comment tree.

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

Maximum number of items to save. Set 0 for no limit.

## `addonCommentReplies` (type: `boolean`):

Fetch nested reply threads for comments that have collapsed replies.

## Actor input object example

```json
{
  "post_id": "t3_1uw2gep",
  "sort_type": "CONFIDENCE",
  "maxItems": 20,
  "addonCommentReplies": false
}
```

# Actor output Schema

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

Every record collected during 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 = {
    "post_id": "t3_1uw2gep",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("toolzerhub/reddit-post-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 = {
    "post_id": "t3_1uw2gep",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("toolzerhub/reddit-post-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 '{
  "post_id": "t3_1uw2gep",
  "maxItems": 20
}' |
apify call toolzerhub/reddit-post-comments-scraper --silent --output-dataset

```

## MCP server setup

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