# Reddit Comments Scraper | Threads & Context (`monkey.d.scraping/reddit-comments-context-scraper`) Actor

Extract Reddit posts, nested comments and replies with parent IDs. Search subreddits, keep matching conversation context, export Markdown or RAG, and resume saved collections.

- **URL**: https://apify.com/monkey.d.scraping/reddit-comments-context-scraper.md
- **Developed by:** [Monkey D. Scraping](https://apify.com/monkey.d.scraping) (community)
- **Categories:** Social media, Developer tools
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.29 / 1,000 comment delivereds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

Extract public Reddit posts, comments and nested replies into an Apify dataset. Built for researchers, brand teams and content creators who need the discussion around a comment. Start from post URLs, search for posts, or browse subreddit listings. Parent IDs and reply depth let you reconstruct each conversation.

**中文用户：** 本页下方提供中文说明，涵盖 Reddit 评论抓取、子版块搜索和品牌口碑监测。

### Main use cases

- **Brand monitoring:** Find public discussions about a brand or product. Keep matching comments together with their parent comments and replies, then reuse a saved collection to review new or edited content.
- **Product and audience research:** Collect discussions about common problems, feature requests and purchase decisions. Export structured rows to compare themes across several threads. Try [Find SaaS Ideas on Reddit](https://apify.com/monkey.d.scraping/reddit-comments-context-scraper/examples/find-saas-ideas-on-reddit).
- **Content and video research:** Review questions and follow-up replies before writing an article or scripting a video. Use the Markdown export to read conversations with source links. Try [Export Reddit Comments to Markdown](https://apify.com/monkey.d.scraping/reddit-comments-context-scraper/examples/export-reddit-comments-to-markdown).
- **Research datasets and RAG:** Keep IDs and thread relationships for analysis, or export text chunks with source links and parent excerpts for retrieval.

### Quick start

1. Paste Reddit post links into **Post URLs**. Include several links to collect them in one run.
2. Set the maximum comments per post, reply depth and total results.
3. Run the Actor. Open **Dataset** for structured results or enable Markdown for a readable thread.

```json
{
  "postUrls": ["https://redd.it/1xom2in"],
  "maxCommentsPerPost": 25,
  "maxDepth": 7,
  "outputMarkdown": true
}
```

At Apify Free rates, a run delivering **one post and five comments costs about $0.00667**, including the start event. See **Pricing** for the event breakdown.

### Find discussions and keep the context

- **Search posts** by query, optionally within specific subreddits. Set the search order and period.
- **Browse subreddits** by name and limit how many posts to discover.
- **Filter comments** with include and exclude phrases or a minimum score. Matching comments can include their available ancestors and a configurable number of reply levels. The dataset labels matching rows and context rows separately.

For example, search `webscraping` for discussions about rate limits, then keep comments mentioning a specific tool and one level of replies.

```json
{
  "sourceMode": "search",
  "searchQuery": "rate limits",
  "subreddits": ["webscraping"],
  "maxPosts": 5,
  "maxCommentsPerPost": 50,
  "keywords": ["proxy"],
  "contextRepliesDepth": 1,
  "outputMarkdown": true
}
```

### Results and exports

| Output | What it contains |
| --- | --- |
| **Dataset** | One row per delivered post or comment, with source URL, author when available, text, score, timestamp, parent ID, post ID and reply depth. Download as JSON or CSV in Apify. |
| **THREAD** | Optional Markdown with the conversation ordered by parent and reply, including source links. |
| **RAG** | Optional bounded text chunks with thread, author, parent excerpt and source metadata. |
| **SUMMARY** | Per-thread outcomes, delivered counts, unavailable content, missing parent references and the reason collection ended. |
| **NEXT_INPUT** | Input for the next run when checkpoint saving is enabled. |

A comment row looks like this. The values are illustrative.

```json
{
  "submissionType": "comment",
  "submissionIdPrefixed": "t1_reply",
  "parentId": "t1_parent",
  "parentPostId": "t3_thread",
  "depth": 1,
  "bodyText": "This worked after I changed the date filter.",
  "contentStatus": "available"
}
```

Use `SUMMARY.threads` to see each thread’s status and collected comment count. A row can retain an observed ID and parent relationship when the source text is unavailable.

### Resume or monitor a collection

Enable **Save progress for reuse** and copy the `NEXT_INPUT` record into your next run. Resume reuses completed threads and revisits incomplete ones. Incremental mode returns new or edited items with their available context. Use matching sources and collection settings when reusing a checkpoint.

Incremental runs reread the selected threads. A missing comment is not interpreted as a deletion.

### Pricing

Pay per valid run started and per post or comment row delivered to the dataset. On the Apify Free plan, the rates are **$0.00285 per run**, **$1.0925 per 1,000 posts**, and **$0.54625 per 1,000 comments**. See the **Pricing** tab for other plans.

Markdown and RAG are included. Context rows count as dataset results. Use Apify's **Maximum cost per run** to cap event spending. If the cap prevents additional results, the Actor reports `charge_limit` and exports the rows it delivered.

### FAQ

**Can I collect nested replies?** Yes. Set the reply depth for your run. Each comment includes `parentId`, `parentPostId` and `depth`. Top-level comments have depth 0.

**How are context rows billed?** Every post or comment row delivered to the dataset counts as its corresponding event, including rows labeled as context. Markdown and RAG exports are included.

**How do I resume a run or look for edits?** Enable **Save progress for reuse**, then use the `NEXT_INPUT` record in the next run. Resume reuses completed threads and revisits incomplete ones. Incremental mode returns new or edited items with their available context.

**Where do I see what the run delivered?** Open the dataset for delivered rows and `SUMMARY.savedComments` for the delivered comment total. `SUMMARY.threads` shows how many comments were collected per thread.

### 中文说明：Reddit 评论抓取工具（Reddit Comments Scraper）

从公开 Reddit 帖子链接、关键词搜索或指定子版块收集帖子、评论和多层回复。结果保留原始链接、父评论 ID 和回复深度，便于还原讨论脉络。

- **品牌与产品调研**：查看用户反馈、竞品讨论和功能需求，保留关键词命中评论的上下文。
- **跨境电商与出海研究**：对比不同子版块中用户的购买顾虑和使用体验。
- **内容策划与资料整理**：把常见问题和后续回复导出为 Markdown，或生成带来源信息的 RAG 文本块。

**快速开始**：粘贴公开帖子链接，设置每帖评论数和回复深度，然后在 Apify 的 Dataset 中查看或导出 JSON、CSV。开启 Markdown 导出后，可在 `THREAD` 中阅读讨论。

```json
{
  "postUrls": ["https://redd.it/1xom2in"],
  "maxCommentsPerPost": 25,
  "maxDepth": 7,
  "outputMarkdown": true
}
```

**价格**：Apify Free 计划下，每次有效运行 $0.00285，每 1,000 条帖子 $1.0925，每 1,000 条评论 $0.54625。交付 1 条帖子和 5 条评论约 $0.00667，含启动费。上下文行按交付的帖子或评论计费，Markdown 和 RAG 导出已包含。其他计划请查看 Pricing 标签页。

**如何继续上一次采集？** 启用保存进度后，将 `NEXT_INPUT` 用于下一次运行。恢复模式会复用已完成的讨论，增量模式会返回新增或编辑的内容及其上下文。

**如何查看每个讨论的结果？** 在 `SUMMARY.threads` 中查看各帖子的状态和采集到的评论数。实际交付的评论总数见 `SUMMARY.savedComments`。

### Related Actors

- [Facebook Comments Scraper](https://apify.com/monkey.d.scraping/facebook-comments-scraper/api) collects public Facebook comments and replies for research across communities.
- [Instagram Comments Scraper](https://apify.com/monkey.d.scraping/instagram-comments-scraper/api) collects public Instagram post and reel comments for audience research.

This independent Actor works with publicly available Reddit content. It is not affiliated with Reddit.

# Actor input Schema

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

Paste links to the Reddit posts you want to read.

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

Maximum comments and replies collected per post, before keyword filtering. Context uses this collected set.

## `sourceMode` (type: `string`):

Choose post links, a search query or subreddit names. Clear post links when using discovery.

## `searchQuery` (type: `string`):

Required in search mode. Finds posts; comment filtering uses the separate words or phrases field.

## `searchSort` (type: `string`):

Order of post discovery in search mode.

## `searchTime` (type: `string`):

Time period for discovering posts in search mode.

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

Names such as Python or Coffee, without r/ or URLs. Required in subreddit mode; optional scope for search.

## `maxPosts` (type: `integer`):

Maximum distinct posts selected across discovery sources.

## `preset` (type: `string`):

Pick a workflow to start with. Settings supplied in the input take precedence.

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

Maximum collected rows across all posts and comments, before filtering. Matching and context rows share this limit.

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

0 reads top-level comments; larger values include replies.

## `includePosts` (type: `boolean`):

Save the original post alongside its comments.

## `keywords` (type: `array`):

Keep matching comments together with their available ancestors and replies. Matches literal text, ignoring case. Leave empty to export all collected comments.

## `excludeKeywords` (type: `array`):

A comment containing any of these phrases cannot match. It can still appear as conversation context.

## `minCommentScore` (type: `integer`):

Leave blank to accept any score. Comments below the threshold or without a score can still appear as context.

## `keywordMatch` (type: `string`):

Match any or all supplied phrases in the same comment.

## `contextRepliesDepth` (type: `integer`):

Reply levels to include below each matching comment. Available ancestors are always retained. Requires words or phrases.

## `outputMarkdown` (type: `boolean`):

Save a parent-first conversation document as THREAD in the key-value store.

## `collectionMode` (type: `string`):

Snapshot collects a fresh dataset. Incremental exports new or edited content with context. Resume consolidates saved rows and continues unfinished posts.

## `saveCheckpoint` (type: `boolean`):

Save progress and a ready-to-copy NEXT_INPUT record for another run. Enabled automatically when reusing a collection.

## `previousStoreId` (type: `string`):

Select the key-value store that contains the previous run’s CHECKPOINT. Required for resume or incremental collection.

## `maxRunSeconds` (type: `integer`):

Time allowed for collection, including its startup. Saving and exporting results happens afterward.

## `outputRag` (type: `boolean`):

Create numbered chunks with comment text, source link, and short thread and parent context.

## `ragMaxCharacters` (type: `integer`):

Maximum characters per chunk, including the context repeated in each part.

## `maxRagChunks` (type: `integer`):

Bound the export size. SUMMARY reports whether the chunk limit was reached; dataset rows are preserved.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.reddit.com/r/webscraping/comments/1xom2in/whats_the_best_way_to_collect_reddit_comments/"
  ],
  "maxCommentsPerPost": 100,
  "sourceMode": "urls",
  "searchSort": "relevance",
  "searchTime": "all",
  "maxPosts": 10,
  "preset": "custom",
  "maxItems": 500,
  "maxDepth": 10,
  "includePosts": true,
  "keywordMatch": "any",
  "contextRepliesDepth": 1,
  "outputMarkdown": true,
  "collectionMode": "snapshot",
  "saveCheckpoint": false,
  "maxRunSeconds": 90,
  "outputRag": false,
  "ragMaxCharacters": 6000,
  "maxRagChunks": 500
}
```

# Actor output Schema

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

Structured conversation records with original authors and parent relationships.

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

No description

## `thread` (type: `string`):

No description

## `rag` (type: `string`):

No description

## `next_input` (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 = {
    "postUrls": [
        "https://www.reddit.com/r/webscraping/comments/1xom2in/whats_the_best_way_to_collect_reddit_comments/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("monkey.d.scraping/reddit-comments-context-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 = { "postUrls": ["https://www.reddit.com/r/webscraping/comments/1xom2in/whats_the_best_way_to_collect_reddit_comments/"] }

# Run the Actor and wait for it to finish
run = client.actor("monkey.d.scraping/reddit-comments-context-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 '{
  "postUrls": [
    "https://www.reddit.com/r/webscraping/comments/1xom2in/whats_the_best_way_to_collect_reddit_comments/"
  ]
}' |
apify call monkey.d.scraping/reddit-comments-context-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,monkey.d.scraping/reddit-comments-context-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/9hL0OmFEscFBjQbyd/builds/2guOdI2sb8zcWGGdM/openapi.json
