# Reddit Post Comments (`opspilot.cc/reddit-post-comments`) Actor

💬 Reddit Post Comments | Every comment under a post, with the thread structure kept Paste a Reddit post id or URL and get each comment as a row — with depth and parentCommentId intact, so you can rebuild who replied to whom instead of a flat pile of text.

- **URL**: https://apify.com/opspilot.cc/reddit-post-comments.md
- **Developed by:** [wang wei](https://apify.com/opspilot.cc) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.005 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Post Comments

> Every comment under a Reddit post — flattened, but never scrambled: `depth` and `parentCommentId` survive.

### ✨ What you get

One dataset row per comment:

| Field | What it is |
|---|---|
| `body` | the comment text |
| `depth` | 0 = top-level comment, 1 = a reply, and so on |
| `parentCommentId` | the comment it replies to — rebuild the tree in one pivot |
| `author` / `authorId` / `isSubmitter` | who wrote it, and whether it is the original poster |
| `score` | upvotes, or `null` when Reddit does not report it |
| `isRemoved` | flagged, not silently dropped — a removed comment still shows where a thread was moderated |
| `postId` / `postTitle` / `subreddit` | which post the comment belongs to |
| `createdAt` | timestamp |

Plus one `thread_report` per post: comments collected vs the thread's own reported count, top-level vs reply split, unique authors, removed count, median and total score.

The run summary adds a coverage note, top keywords and the highest-scoring comments.

### 💼 Use cases

- **Rebuilding a conversation as a tree for analysis** — `depth` (0 = top-level, 1 = a reply) and `parentCommentId` survive on every row, so one pivot turns a flat export back into the real exchange. That is how you find the sub-thread where a claim was actually challenged instead of where it was asserted.
- **Measuring how much of a thread you actually got** — each post gets a `thread_report` with comments collected against the thread's own reported count, plus the top-level vs reply split, unique authors, removed count and median score. Run it before you quote a number about that discussion.
- **Telling an OP apart from the crowd** — `isSubmitter` marks the original poster, so you can pull the seller's own replies (warranty claims, "which model is this?") out of the noise and read how the brand handled objections.
- **Deciding whether a thread is worth mining at all** — with `sortBy: confidence` you get Reddit's own ranking instead of the upvote sort, which surfaces the replies people found useful rather than the ones that won an argument. Useful when you want a fair read before you build a vocabulary or a FAQ from the thread.

### ✅ Who this is for

- **User researchers** who need the actual exchange under a launch or complaint thread, not a summary of it, and who need to know which replies changed the OP's mind.
- **Community managers** preparing an AMA or a support macro pack, who need to see how moderators treated the thread — `isRemoved` marks every moderated comment instead of quietly dropping it.
- **Content and SEO teams** mining one thread for the vocabulary real users use, who need `depth` to separate an original observation from a reply that only exists because someone disagreed.
- **Analysts auditing a discussion** who must state their coverage honestly and can cite the thread report's collected-vs-reported gap in the writeup.

### ❌ Who this is NOT for

- **Whole-thread extraction** — you get the **first page** of the comment forest only. Deeper pages need an authenticated Reddit session, which this Actor does not use. When the `thread_report` shows 300 comments reported and 100 collected, the missing 200 are not an error you can configure away.
- **Anyone averaging the `score` column** — a null score is kept as null and never coerced to 0, because Reddit frequently omits it, especially deep inside nested reply forests. Average over the rows that have scores or your numbers will be silently wrong; a null means unknown, not zero.
- **Reading `sortBy: score` as "the best comments"** — sorting by score and by `top` are close but not identical, and Reddit's `confidence` ranking is its own algorithm. The same thread yields a different set of top comments under each, so do not compare counts across runs that used different sorts.
- **Sentiment or complaint mining at scale** — a single post's comment forest is not a sample of the product's reception, and Reddit is not a review platform: it captures pre-purchase doubts and arguments, not post-purchase ratings. One viral thread can be entirely one-sided argument about an unrelated issue.
- **Bulk subreddit research** — this needs specific `t3_…` post ids. To discover which posts exist in a community first, run the subreddit posts Actor and chain its `postId` values in here.

### 🚀 Quick start

1. Open the Actor and press **Start** (defaults to one r/ProductManagement thread).
2. The post id is the `t3_…` part of a Reddit URL — paste either the id or the whole URL.
3. Pivot on `depth` and `parentCommentId` to rebuild the conversation.

### 📥 Input parameters

| Parameter | Type | Default | What it does |
|---|---|---|---|
| `postIds` | list | one public thread | Post ids (`t3_…`) or full post URLs, one per line, up to 50 per run. |
| `sortBy` | select | `top` | `top` (most upvoted), `confidence` (Reddit's own pick), `new`, `hot`, `controversial`, `old`. |
| `maxCommentsPerPost` | number | `100` | Cap on collected comments per post (1–500). Cost scales linearly with posts. |

### 📤 Output

- **Dataset** — comment rows + one `thread_report` per post (or a notice when nothing was collected)
- **SUMMARY** — thread stats, coverage note, top keywords, most-upvoted comments, warnings

### ⚙️ How it works

1. Each input is reduced to a `t3_…` post id (full URLs and `/comments/<id>/` paths both work).
2. The comment forest is walked recursively, so nested replies are included and tagged with their depth and parent.
3. Reddit reports a total comment count per thread but does not hand out a usable cursor on this leg, so the summary states the gap instead of implying full coverage.

### 💰 Billing

**Billed per run.** A single `apify-actor-start` charge applies when the run begins, at the price shown on this Actor's page. A run that returns 300 rows costs the same as one that returns 3. There is no daily run cap.

**Free plan limit.** One run collects **5 posts over 2 pages, 100 comments each**. That is a hard ceiling on the upstream cost, so it cannot be raised from the input form. A capped run still succeeds: it writes a `notice` row to the dataset, sets `appliedLimits.capped: true` in `SUMMARY`, and logs why. Any paid Apify plan lifts the cap to 50 posts over 4 pages.

### ❓ FAQ

**Do I get the whole thread?**
You get the first page of the comment forest — the reported total is in the thread report so you can see the gap. Deeper pages need an authenticated Reddit session, which this Actor does not use.

**Why is `score` sometimes null?**
Reddit omits the score for some comments (and inside nested reply forests it is often absent). A null score is kept as null, never turned into 0, so your averages stay honest.

**Why are removed comments included?**
Because knowing a thread was moderated is data. Filter on `isRemoved` when you only want readable comments.

**Can I get the post itself (title, votes, subreddit)?**
The title and subreddit ride along on every comment row, and the thread report repeats them per post.

**Does the order of rows matter?**
It follows the sort you asked for. Sorting by `score` and by `top` are close but not identical — Reddit's "confidence" ranking is its own algorithm.

### 📚 Resources

- Reddit public comment data (no login required)
- Apify free plan: monthly credit covers usage, no separate daily cap

# Changelog

This Actor's version history is a separate document: https://apify.com/opspilot.cc/reddit-post-comments/changelog.md

# Actor input Schema

## `postIds` (type: `array`):

One per line, up to 50 posts per run. The id is the t3\_… part of the URL: reddit.com/r/<sub>/comments/\<t3_id>/<slug>/.

## `sortBy` (type: `string`):

Top for what resonated, new for a live conversation, confidence for the discussion Reddit promotes.

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

Cap on collected comments per post. Cost scales linearly with posts.

## Actor input object example

```json
{
  "postIds": [
    "https://www.reddit.com/r/ProductManagement/comments/1u6pv0o/quarterly_career_thread/"
  ],
  "sortBy": "top",
  "maxCommentsPerPost": 100
}
```

# Actor output Schema

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

One row per comment plus one thread_report per post, or a single notice when nothing was collected.

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

Thread stats, top keywords, most-upvoted comments, coverage note and warnings.

# 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("opspilot.cc/reddit-post-comments").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("opspilot.cc/reddit-post-comments").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 opspilot.cc/reddit-post-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,opspilot.cc/reddit-post-comments"
        }
    }
}
```

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/p8YhEWZCn3WhVyfUz/builds/CJIU03XHUvwfJuAG1/openapi.json
