# Reddit Posts & Comments Scraper (`devcake/reddit-search-scraper`) Actor

Find viral content ideas, and research niche communities. Extract Reddit posts, comments, and discussion data from search queries.

- **URL**: https://apify.com/devcake/reddit-search-scraper.md
- **Developed by:** [devcake](https://apify.com/devcake) (community)
- **Categories:** Social media, Other, SEO tools
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

## Scrape Reddit posts and comments for market research and lead generation

This Reddit scraper collects public posts and comment threads for any keyword. It is built for marketers, content teams, researchers, and data teams that need organized Reddit insights.

### 📥 What you get

Posts, comment threads, and engagement stats are delivered in one structured dataset. Each result includes the post's community, title, author, engagement, content, link, and publication time. Turn on comment extraction to include the conversation under each post.

Use it for audience research, topic discovery, sentiment analysis, lead generation, and content planning.

### ⚙️ How it works

Add your search terms, choose how many results you want, and decide whether to include comments. The Actor collects matching public discussions and saves them to your dataset for review or export.

### 🎛️ Configure your scrape

Nine fields cover everything:

- 🔍 **Search Queries** — 1 to 50 terms (required)
- 📊 **Max Results** — posts per query (default 20, max 200)
- 💬 **Extract Comment Text** — toggle comment bodies
- 🧵 **Max Comments Per Post** — per-thread cap from 1-500 (default 100)
- 🔥 **Sort By** — `relevance`, `hot`, `new`, `top`, or `comments`
- ⏰ **Time Filter** — `hour`, `day`, `week`, `month`, `year`, or `all`
- ⚡ **Processing Speed** — control how quickly post details are collected
- 🔀 **Parallel Queries** — run independent searches concurrently (default 3)
- 🚀 **Comment Speed** — parallelize larger comment-page requests (default 2)

```json
{
  "queries": ["python", "openai"],
  "max_posts_per_query": 20,
  "include_comments": true,
  "max_comments_per_post": 50,
  "sort": "relevance",
  "time": "all",
  "detail_workers": 4,
  "comment_expansion_workers": 2
}
```

### 📦 Output format

One row per post. Comments are embedded when enabled. Every row reports whether collection was complete, partial, or failed. Run stats land in the default key-value store as `RUN_STATS` so you can monitor counts, errors, and timing per query.

```json
{
  "dataType": "post",
  "id": "abc123",
  "subreddit": "python",
  "author": "example_user",
  "title": "Example Reddit post",
  "score": 42,
  "num_comments": 18,
  "created_iso": "2026-06-23T12:00:00+00:00",
  "search_query": "python",
  "collection_status": "complete",
  "comments_expected": 5,
  "comments_extracted": 5,
  "comments": [
    {"dataType": "comment", "id": "t1_example", "author": "commenter", "body": "Comment body", "score": 5, "depth": 0}
  ]
}
```

### 🎯 Who uses this Reddit scraper

- 🎯 **Marketers and founders** — find posts where buyers describe the problem your product solves, or where users complain about a competitor.
- 📣 **Content teams** — surface viral posts and trending topics in your niche, and compare activity across subreddits.
- 🤖 **Data and ML teams** — pull Reddit comment threads for sentiment analysis and NLP training datasets, with author, score, depth, and timestamp on every row.

### ❓ Frequently asked questions

#### 🔧 How do I scrape Reddit?

Add 1-50 search queries, click Run, and receive matching posts and comments in a structured dataset. Results are ready for export to CSV, JSON, or your data warehouse.

#### 💬 How do I scrape Reddit comments for sentiment analysis?

Turn on **Extract Comment Text** and pass 5-10 product or topic queries like `iphone 15` or `windows 11`. Each post row embeds up to your selected limit of available comments with author, body, score, depth, parent link, and timestamp. The collection status shows when Reddit returned fewer comments than requested.

#### ⚖️ Is scraping Reddit legal?

Scraping public Reddit content for personal research and analysis is generally accepted practice. This Actor targets public posts and comments only — it does not bypass Reddit's age gate, login walls, or private communities. Always review Reddit's Terms of Service and your local data-protection rules before commercial use.

#### 💸 Is there a free Reddit scraper?

This Actor runs on Apify's pay-per-use pricing — you only pay for the compute your run consumes. Apify's free tier gives you a monthly allowance to test the Reddit scraper with small queries before scaling up. Start with `max_posts_per_query: 5` for a free smoke test.

#### 🐍 Can I use the results in Python?

Yes. Export the dataset in your preferred format or retrieve it from Apify for use in your Python workflow.

#### 🆚 What is the best Reddit scraper?

The best Reddit scraper is reliable, easy to configure, and returns consistent, useful results. This Actor keeps setup simple while collecting posts and comments in an analysis-ready format.

# Actor input Schema

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

Enter keywords to search Reddit. Each query runs as a separate search.

## `max_posts_per_query` (type: `integer`):

Posts to collect per query. Higher = longer runtime. Test with 1-5 first.

## `include_comments` (type: `boolean`):

Include available comment text with each post.

## `max_comments_per_post` (type: `integer`):

Maximum comments to extract per post. Lower values run faster.

## `detail_workers` (type: `integer`):

Controls how quickly post details are collected. The default works well for most runs.

## `comment_expansion_workers` (type: `integer`):

Controls parallel fallback requests used when the initial post page does not contain enough comments. Separate sticky sessions are used for values above 1.

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

'Relevance' and 'Comments' sort by search metrics. 'Hot', 'New', 'Top' sort by activity.

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

Limit posts by age. <strong>hour</strong>=past hour, <strong>day</strong>=24h, <strong>week</strong>=7d, <strong>month</strong>=30d, <strong>year</strong>=365d, <strong>all</strong>=no filter.

## Actor input object example

```json
{
  "queries": [
    "AI startups 2026"
  ],
  "max_posts_per_query": 20,
  "include_comments": false,
  "max_comments_per_post": 100,
  "detail_workers": 4,
  "comment_expansion_workers": 2,
  "sort": "relevance",
  "time": "all"
}
```

# Actor output Schema

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

Complete scraped data with all fields

## `overview` (type: `string`):

Simplified view with key fields: id, subreddit, title, url, score, num\_comments

## `details` (type: `string`):

Full post details: author, title, selftext, score, num\_comments, created\_utc, is\_self

## `comments` (type: `string`):

Comment bodies with author, score, depth, and reply counts

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

Run statistics: queries processed, posts collected, errors, runtime

# 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 = {
    "queries": [
        "AI startups 2026"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("devcake/reddit-search-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 = { "queries": ["AI startups 2026"] }

# Run the Actor and wait for it to finish
run = client.actor("devcake/reddit-search-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 '{
  "queries": [
    "AI startups 2026"
  ]
}' |
apify call devcake/reddit-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devcake/reddit-search-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/1GuMUVhngIr8rdOte/builds/jWGGe7fZWg7hsthNE/openapi.json
