# Reddit Scraper — All Comments, Monitor Mode, Markdown ($1.5/1k) (`theoliveirad/reddit-comments-posts-scraper`) Actor

Scrape Reddit posts + 100% of the comment tree (97.6% benchmarked). Monitor mode: only new items on scheduled runs. Strict keyword search, date & flair filters, LLM-ready Markdown. No API key, no login. From $1.50 per 1,000 results.

- **URL**: https://apify.com/theoliveirad/reddit-comments-posts-scraper.md
- **Developed by:** [Diogo Oliveira](https://apify.com/theoliveirad) (community)
- **Categories:** AI, Lead generation, Social media
- **Stats:** 2 total users, 0 monthly users, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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.

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 Comments & Posts Scraper — Full Threads, Every Comment

Scrape Reddit posts, **complete comment trees**, subreddits, users, and search results. No API key, no login, no rate limits. Pure HTTP — fast and cheap.

### Why this scraper

**🧵 100% of the comment tree.** Most Reddit scrapers silently return only the comments that load on the page and skip the "load more comments" branches. This Actor recursively expands every `morechildren` stub until the tree is exhausted. If a cap is hit, items are explicitly flagged `commentsTruncated: true` — you always know whether a thread is complete.

**📡 Monitor mode.** Turn any input into a scheduled monitor: on each run, only posts and comments that are NEW since the previous run are returned. Brand mentions, keyword alerts, community tracking — without deduping downstream.

**🤖 LLM-ready output.** `outputFormat: "markdown"` adds one clean Markdown document per thread (post + threaded comments, ordered by score, with a `tokensEstimate` field), ideal for RAG pipelines, AI agents, and NotebookLM-style workflows. Token budgeting via `markdownMaxTopComments`. The doc comes on top of the structured items at no extra charge.

**🎯 Search that respects your keywords.** Reddit search is notoriously loose — the most common complaint against Reddit scrapers is "I searched X and got unrelated Y". Turn on `strictKeywordFilter` and every word of your query must actually appear in the post's title, body, or URL.

**📅 Date-range filters.** `postedAfter` / `postedBefore` and `commentedAfter` / `commentedBefore` (date or full ISO 8601). With `sort: "new"`, pagination stops early once posts fall outside your window — you don't pay for pages you don't need.

**🏷️ Flair filters.** `onlyWithFlair: true` or target specific flairs with `flairFilter: ["Discussion", "Help"]` (case-insensitive).

**🔎 Deep scan.** Reddit caps any listing at ~1,000 posts. `deepScan: true` combines every sort and time window and dedupes, surfacing several times more unique posts per subreddit.

**⚡ Pure HTTP.** No headless browser: faster runs, lower platform usage, fewer failures. Automatic anti-blocking with tiered proxy escalation — a 403 never kills your run.

**💶 Honest billing.** You pay per scraped item, with `maxItems` as a hard cost cap you control. Filtered-out posts don't count against your bill, truncation is always flagged, and the run status message reports exactly what happened.

### Live benchmark (July 12, 2026)

Real thread from r/AskReddit with **1,014 declared comments**:

| Method | Comments retrieved | Coverage |
|---|---|---|
| Inline page load only (what most scrapers return) | 491 | 48% |
| **This Actor (full 3-phase expansion)** | **990** | **97.6%** |

The remaining ~2% are deleted/removed comments — counted in Reddit's total but not retrievable by anyone. Total cost: 28 HTTP requests, ~40 seconds. Runs are always flagged `commentsTruncated` if any cap was hit, so partial data is never silent.

### Input examples

Monitor a keyword in one community (schedule this daily):

```json
{
  "searches": ["shopify"],
  "searchCommunityName": "ecommerce",
  "sort": "new",
  "monitorMode": true,
  "scrapeComments": false,
  "maxItems": 200
}
```

Full thread as LLM Markdown:

```json
{
  "startUrls": [{ "url": "https://www.reddit.com/r/webscraping/comments/abc123/example/" }],
  "outputFormat": "markdown",
  "maxCommentsPerPost": 2000
}
```

Archive a whole subreddit beyond the 1k cap:

```json
{
  "subreddits": ["MachineLearning"],
  "deepScan": true,
  "scrapeComments": false,
  "maxItems": 5000
}
```

Precise search: only posts that really mention your brand, from June 2026 onward:

```json
{
  "searches": ["acme widgets"],
  "strictKeywordFilter": true,
  "postedAfter": "2026-06-01",
  "sort": "new",
  "scrapeComments": false,
  "maxItems": 500
}
```

Flair-targeted community research:

```json
{
  "subreddits": ["ecommerce"],
  "flairFilter": ["Discussion", "Question"],
  "postedAfter": "2026-01-01",
  "scrapeComments": true,
  "maxCommentsPerPost": 300
}
```

### Output

Structured items with `dataType`: `post`, `comment`, `community`, `user`, or `thread_markdown`. Every item also carries a unified `content` field (post title / comment body) so mixed exports render cleanly in one column. Comments carry `parentId`, `depth`, and `threadPath` (e.g. `"c1/c2/c5"`) so you can rebuild the exact tree in one pass. All timestamps are ISO 8601 UTC. Export JSON, CSV, Excel via the Apify API or console.

```json
{
  "dataType": "comment",
  "id": "c2",
  "parentId": "t1_c1",
  "postId": "p1",
  "author": "alice_dev",
  "body": "Thanks, trying that now.",
  "score": 7,
  "depth": 1,
  "threadPath": "c1/c2",
  "isSubmitter": true,
  "createdAt": "2026-07-12T06:43:20+00:00",
  "permalink": "https://www.reddit.com/r/webscraping/comments/p1/x/c2/"
}
```

### Integrations

Works with the Apify MCP server (give AI agents direct access), n8n, Make, Zapier, LangChain, and the Apify API (Python/JS clients). Schedules + monitor mode = zero-infrastructure Reddit alerting.

### FAQ

**Do I need a Reddit account or API key?** No. Only publicly visible content is scraped.

**Legal?** Scraping publicly available data is generally permissible, but you are responsible for complying with applicable laws (including GDPR when storing usernames) and Reddit's terms for your use case. Intended uses: research, sentiment analysis, brand monitoring, AI/RAG datasets.

**Why are some threads flagged truncated?** You hit `maxCommentsPerPost`. Raise it (cost scales with results) — the flag exists so partial data is never silent.

# Actor input Schema

## `startUrls` (type: `array`):

Any Reddit URLs: posts (full comment tree), subreddits, user pages, or search result URLs.

## `searches` (type: `array`):

Keywords to search across Reddit (or inside one community — see 'Restrict search to community').

## `searchCommunityName` (type: `string`):

Subreddit name (without r/) to scope all search terms to, e.g. 'ecommerce'.

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

Subreddit names (without r/) to scrape, e.g. 'webscraping'.

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

Listing/search sort order.

## `time` (type: `string`):

Time filter for 'top' / 'controversial' / search sorts.

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

Hard cap on total results (posts + comments) — controls your cost.

## `maxPostsPerSource` (type: `integer`):

Cap on posts fetched from each subreddit/search/user source.

## `scrapeComments` (type: `boolean`):

Fetch the FULL comment tree for every post (all 'load more comments' branches expanded).

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

Cap per post. If hit, items are flagged commentsTruncated=true — you always know if a tree is partial.

## `commentsSort` (type: `string`):

Order used when expanding comment trees.

## `postedAfter` (type: `string`):

Only keep posts created on or after this date — 'YYYY-MM-DD' (00:00 UTC) or full ISO 8601. Tip: combine with sort='new' for fastest runs (pagination stops early once posts get older than this).

## `postedBefore` (type: `string`):

Only keep posts created on or before this date — 'YYYY-MM-DD' (23:59:59 UTC) or full ISO 8601.

## `commentedAfter` (type: `string`):

Only keep comments created on or after this date (UTC). 'YYYY-MM-DD' or ISO 8601.

## `commentedBefore` (type: `string`):

Only keep comments created on or before this date (UTC). 'YYYY-MM-DD' or ISO 8601.

## `onlyWithFlair` (type: `boolean`):

Drop posts without any flair assigned.

## `flairFilter` (type: `array`):

Keep only posts whose flair matches one of these values (case-insensitive, substring match) — e.g. 'Discussion', 'Help'. Leave empty to keep all flairs.

## `strictKeywordFilter` (type: `boolean`):

Reddit search often returns loosely related posts. When enabled, every word of your search term must actually appear in the post's title, body, or link URL — fewer results, but they match what you asked for.

## `deepScan` (type: `boolean`):

Combine all sorts and time windows per subreddit and dedupe, surfacing far more than the ~1k listing cap.

## `includeNSFW` (type: `boolean`):

Include posts and comments marked NSFW (over\_18) in the results.

## `includeCommunityInfo` (type: `boolean`):

Push one community item (subscribers, description) per scraped subreddit.

## `includeUserInfo` (type: `boolean`):

Push one user item (karma, created date) per scraped user page.

## `outputFormat` (type: `string`):

'items' = structured post/comment rows only. 'markdown' and 'both' are IDENTICAL: structured items PLUS one LLM-ready Markdown document per thread (with a token estimate). You're billed per structured item either way — the Markdown doc is a free extra.

## `markdownMaxTopComments` (type: `integer`):

Keep only the N highest-scored top-level comment branches in Markdown output (token budgeting).

## `concurrency` (type: `integer`):

Parallel thread fetches (1-10). Higher = faster but more block risk.

## `monitorMode` (type: `boolean`):

Remembers what it already saw: on scheduled runs, only NEW posts/comments since the previous run are returned. Ideal for brand/keyword monitoring. Note: the memory is keyed to your sources + sort + time window — changing startUrls/searches/subreddits/sort/time starts fresh (the next run returns everything again).

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/webscraping/"
    }
  ],
  "sort": "top",
  "time": "week",
  "maxItems": 1000,
  "maxPostsPerSource": 5,
  "scrapeComments": true,
  "maxCommentsPerPost": 200,
  "commentsSort": "top",
  "onlyWithFlair": false,
  "strictKeywordFilter": false,
  "deepScan": false,
  "includeNSFW": false,
  "includeCommunityInfo": false,
  "includeUserInfo": false,
  "outputFormat": "items",
  "concurrency": 3,
  "monitorMode": false
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/webscraping/"
        }
    ],
    "sort": "top",
    "time": "week",
    "maxPostsPerSource": 5,
    "maxCommentsPerPost": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("theoliveirad/reddit-comments-posts-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 = {
    "startUrls": [{ "url": "https://www.reddit.com/r/webscraping/" }],
    "sort": "top",
    "time": "week",
    "maxPostsPerSource": 5,
    "maxCommentsPerPost": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("theoliveirad/reddit-comments-posts-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/webscraping/"
    }
  ],
  "sort": "top",
  "time": "week",
  "maxPostsPerSource": 5,
  "maxCommentsPerPost": 200
}' |
apify call theoliveirad/reddit-comments-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=theoliveirad/reddit-comments-posts-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/zCAs8u9qx5ZsxeqTK/builds/32cnd7tX2EdkkBcsy/openapi.json
