# Reddit Scraper Pro (`webdatalabs/reddit-scraper-pro`) Actor

Reddit scraper for automation workflows. Track keywords across Reddit or inside chosen communities, monitor subreddits, score posts with AFINN sentiment and pull full comment threads. Flat JSON - title, body, author, subreddit, score, flair, timestamps, matched keywords - for n8n and Zapier.

- **URL**: https://apify.com/webdatalabs/reddit-scraper-pro.md
- **Developed by:** [WebDataLabs](https://apify.com/webdatalabs) (community)
- **Categories:** Social media, Automation, News
- **Stats:** 167 total users, 14 monthly users, 96.7% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per event

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 Scraper Pro - Posts, Comments & Sentiment Analysis

**High-performance Reddit scraper (99%+ success rate) for automation workflows.** Monitor subreddits, track keywords with sentiment analysis, scrape comments, and integrate with n8n/Zapier for powerful automation.

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com)
[![Reliability](https://img.shields.io/badge/Success%20Rate-99%25+-brightgreen)]()
[![Automation](https://img.shields.io/badge/Automation-First-orange)]()

### 🆚 Why Choose Reddit Scraper Pro?

| Feature | Reddit Scraper Pro | trudax/reddit-scraper | Other Reddit Scrapers |
|---------|-------------------|---------------------|----------------|
| **Success Rate** | **99%+** | 69-92% | 70-90% |
| **User Rating** | 4.5+ (target) | 2.50-2.66 | 2.5-3.5 |
| **State Management** | ✅ No duplicates across runs | ❌ No | ❌ No |
| **Webhook Alerts** | ✅ Built-in n8n/Zapier | ❌ No | ⚠️ Limited |
| **Sentiment Analysis** | ✅ AFINN-165 NLP | ❌ No | ❌ No |
| **Comment Scraping** | ✅ With depth control | ⚠️ Limited | ⚠️ Limited |
| **Pricing Model** | ✅ Pay-per-post (predictable) | ⚠️ Varied | ⚠️ Compute-time |
| **Scheduled Runs** | ✅ Optimized for automation | ⚠️ Limited | ⚠️ Limited |

### ✨ Key Features

- **🎯 99%+ Success Rate** - Smart rate limiting, exponential backoff, residential proxy support
- **🔄 State Management** - No duplicate posts across scheduled runs (tracks 10k recent post IDs)
- **📊 Sentiment Analysis** - Built-in NLP using AFINN-165 (positive/negative/neutral classification)
- **🔔 Webhook Integration** - Direct n8n/Zapier support for real-time alerts
- **💬 Comment Scraping** - Configurable depth (0-5 levels) for deep analysis
- **💰 Predictable Pricing** - Transparent pay-per-post model (see current pricing in the Apify Console when starting a run)
- **⚡ Incremental Scraping** - Only fetch new posts since last run for efficient scheduled automation

### 🎯 Use Cases

#### Brand Monitoring with Sentiment Analysis

```json
{
  "searchMode": "keyword",
  "keywords": ["YourBrand", "YourProduct"],
  "subreddits": ["webdev", "SaaS"],
  "analyzeSentiment": true,
  "webhookUrl": "https://n8n.io/webhook/reddit-alerts",
  "maxAgeHours": 24
}
```

**Result:** Daily alerts when your brand is mentioned, with sentiment context (positive/negative/neutral).

#### Subreddit Monitoring for New Posts

```json
{
  "searchMode": "subreddit",
  "subreddits": ["webdev", "programming", "javascript"],
  "maxItemsPerSubreddit": 100,
  "minUpvotes": 10,
  "maxAgeHours": 24
}
```

**Result:** Daily scrape of high-quality posts (10+ upvotes) from last 24 hours. Schedule every 24 hours.

#### Competitor Tracking Across Reddit

```json
{
  "searchMode": "keyword",
  "keywords": ["Competitor1", "Competitor2"],
  "subreddits": ["webdev", "SaaS", "startups"],
  "minUpvotes": 5,
  "analyzeSentiment": true,
  "includeComments": true,
  "commentDepth": 1
}
```

**Result:** Track competitor mentions with engagement metrics, sentiment, and top-level comments.

#### Trend Analysis with Comments

```json
{
  "searchMode": "keyword",
  "keywords": ["AI", "ChatGPT", "GPT-4", "Claude"],
  "maxItemsPerSubreddit": 500,
  "analyzeSentiment": true,
  "includeComments": true,
  "commentDepth": 2
}
```

**Result:** Deep analysis of AI trends with comment discussions (2 levels deep).

### 📥 Input Configuration

#### Quick Start (Default Settings)

Just click "Start" to test with default configuration:

```json
{
  "searchMode": "keyword",
  "keywords": ["AI", "ChatGPT", "web scraping"],
  "subreddits": ["webdev", "programming", "technology"],
  "maxItemsPerSubreddit": 50
}
```

#### Search Modes

**1. Keyword Search** (recommended for automation)
Search all of Reddit (or specific subreddits) for keywords:

```json
{
  "searchMode": "keyword",
  "keywords": ["Apify", "web scraping"],
  "subreddits": ["webdev", "programming"]
}
```

Leave `subreddits` empty to search **all of Reddit**.

**2. Subreddit Monitoring** (`subreddits` is **required** in this mode)
Work inside specific communities:

```json
{
  "searchMode": "subreddit",
  "subreddits": ["webdev", "javascript"],
  "keywords": ["Apify"]
}
```

- **With keywords** - each community is searched for your keywords through Reddit's own search, which matches **post titles and post bodies**. Multi-word keywords are searched as a phrase. Results come back newest-first.
- **Without keywords** - you simply get the newest posts of each community.
- `keywords_matched` on every row tells you which of your keywords literally appear in that post; an empty list means Reddit's search returned it as a related match.

#### Which mode should I use?

Pick **Keyword Search** when you care about a *topic or brand wherever it appears*; pick **Subreddit Monitoring** when you care about *everything happening in specific communities*.

| Your goal | Mode | Example input |
|-----------|------|---------------|
| Every mention of your brand across Reddit | Keyword | `keywords: ["YourBrand"]`, `subreddits: []` |
| A keyword, but only inside certain subreddits | Keyword | `keywords: ["ChatGPT"]`, `subreddits: ["programming"]` |
| Posts about a phrase inside certain communities | Subreddit | `subreddits: ["webdev"]`, `keywords: ["dark mode bug"]` |
| Everything new in your communities | Subreddit | `subreddits: ["django", "flask"]` |

#### Essential Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `searchMode` | enum | `"keyword"` | `keyword` or `subreddit` |
| `keywords` | array | `["AI", "ChatGPT", ...]` | Keywords to search/filter |
| `subreddits` | array | `["webdev", ...]` | Subreddits to monitor (without "r/") |
| `maxItemsPerSubreddit` | integer | `50` | Hard cap on posts fetched, saved **and charged** — per subreddit in subreddit mode, per keyword x subreddit in keyword mode (1-10,000) |
| `searchSort` | enum | `"relevance"` | Keyword-mode sort only; subreddit mode always fetches newest-first |
| `minUpvotes` | integer | `0` | Minimum upvotes filter (0 = keep everything) |
| `maxAgeHours` | integer | `0` | Max post age in hours (0 = no age limit; 168 = 7 days) |
| `includeComments` | boolean | `false` | Fetch comments (one extra request per saved post) |
| `commentDepth` | integer | `1` | Comment reply depth (0 = top-level only, up to 5) |
| `analyzeSentiment` | boolean | `true` | Enable sentiment analysis |
| `dedupeAcrossRuns` | boolean | `false` | Remember delivered posts between scheduled runs and never re-charge them |
| `webhookUrl` | string | - | POST results to this URL |

#### Advanced Filtering

Control data quality with filters:

```json
{
  "minUpvotes": 10,
  "maxAgeHours": 24,
  "includeComments": true,
  "commentDepth": 2
}
```

### 📤 Output Schema

Each post includes **comprehensive metadata**:

```json
{
  "id": "01HQZX9K3P2VQWE8RTGBNM4567",
  "platform": "reddit",
  "type": "post",
  "reddit_id": "abc123",
  "subreddit": "webdev",
  "subreddit_prefixed": "r/webdev",

  "title": "Amazing new web scraping tool",
  "body": "Just discovered Apify and it's incredible...",
  "author": "username",
  "url": "https://apify.com",
  "reddit_url": "https://www.reddit.com/r/webdev/comments/...",

  "score": 156,
  "upvotes": 180,
  "num_comments": 42,
  "gilded": 2,

  "sentiment_score": 5.2,
  "sentiment_comparative": 0.35,
  "sentiment_label": "positive",

  "keywords_matched": ["Apify"],
  "created_utc": "2025-10-16T10:00:00Z",
  "flair": "Discussion",

  "comments": [...],

  "ingest_meta": {
    "first_seen_at": "2025-10-16T11:00:00Z",
    "scrape_run_id": "...",
    "actor_run_id": "..."
  }
}
```

#### Sentiment Analysis Fields

- **sentiment\_score**: AFINN score (-5 to +5, 0 = neutral)
- **sentiment\_comparative**: Normalized score per word
- **sentiment\_label**: `positive`, `negative`, or `neutral`

**Example Sentiment Interpretation:**

- `sentiment_score: 5.2, label: "positive"` → Very positive post
- `sentiment_score: -3.8, label: "negative"` → Negative sentiment
- `sentiment_score: 0.5, label: "neutral"` → Neutral/mixed

### 📊 Dataset Views in Apify Console

The actor provides **3 optimized views**:

1. **Overview** - Main view with 8 key fields (title, subreddit, author, score, comments, sentiment, date, link)
2. **Engagement & Sentiment** - Combined metrics for deeper insights (score, upvote ratio, awards, sentiment)
3. **Full Details** - Complete dataset with all 43 fields for advanced analysis

### 🔗 Webhook Integration

#### n8n Workflow Example

1. **Create webhook trigger in n8n**
2. **Configure Reddit Scraper Pro:**

```json
{
  "searchMode": "keyword",
  "keywords": ["YourBrand"],
  "webhookUrl": "https://your-n8n.com/webhook/reddit",
  "analyzeSentiment": true
}
```

3. **Process in n8n:**
   - Filter by sentiment: `sentiment_label === "negative"`
   - Send negative mentions to Slack/email
   - Store all results in Airtable/Google Sheets
   - Create follow-up tasks in ClickUp/Asana

#### Zapier Workflow Example

Use Zapier's "Webhook by Zapier" trigger with the `webhookUrl` configuration.

#### Webhook Payload (Batch Mode)

Results are sent at the end of each run:

```json
{
  "type": "batch",
  "timestamp": "2025-10-16T11:00:00Z",
  "runId": "abc123",
  "posts": [
    { /* post 1 */ },
    { /* post 2 */ }
  ],
  "stats": {
    "totalPosts": 42,
    "totalComments": 180,
    "keywordMatches": 38,
    "sentimentDistribution": {
      "positive": 15,
      "negative": 8,
      "neutral": 19
    }
  }
}
```

### 🔄 Incremental Scraping (opt-in)

Set `dedupeAcrossRuns: true` to make scheduled monitoring incremental:

- **No duplicates** - posts already delivered by an earlier run are skipped and **not charged again**
- **Scoped per target** - state is keyed by your search mode + subreddits + keywords, so different monitors do not interfere
- **Bounded** - the last 10,000 post IDs are remembered

**How it works:**

1. First run: saves the delivered post IDs
2. Next run with the same subreddits/keywords: skips the ones already delivered
3. A repeat run can therefore legitimately return **zero new posts** — the run log and the `OUTPUT` record say so explicitly

Leave it off (the default) for one-off runs where you want the full result set every time.

### 🧾 Run outcome record (`OUTPUT`)

Every run writes an `OUTPUT` record to its key-value store with `status`
(`SUCCESS` / `PARTIAL` / `NO_RESULTS` / `FAILED`), how many posts were fetched vs
actually saved, per-target results, and exactly why anything was dropped
(too old, below the upvote floor, duplicate). A run that finds nothing says which
input found nothing and why — it never reports success over an empty dataset.

### 💰 Pricing

**Pay-Per-Event Model:** Transparent pay-per-post pricing

You only pay for posts successfully scraped. See current pricing in the Apify Console when starting a run.

**Plus:** Apify platform costs:

- Compute time (minimal for standard runs)
- Residential proxy bandwidth (required for reliability)

**Cost Optimization Tips:**

- Use `maxItemsPerSubreddit` to limit scraping
- Set `maxAgeHours` to 24 for daily monitoring
- Use `minUpvotes` filter (focus on quality content)
- Disable `includeComments` unless needed (significantly reduces runtime)

### 🛡️ Built-in Anti-Blocking

Reddit blocks datacenter traffic, so this scraper automatically routes through **residential proxies** for a high success rate — no setup needed on your side.

**Cost:** Residential proxy bandwidth is billed separately by Apify (see current proxy pricing in the Apify Console).

### 🕐 Rate Limiting & Reliability

Built for stable, hands-off automation:

- Smart request pacing to keep runs reliable
- Automatic retries with exponential backoff on transient errors
- Residential proxy rotation for high success rates

**Best Practices:**

- Don't run multiple instances simultaneously
- Schedule runs at least 10 minutes apart
- Use state management to avoid reprocessing

### 📅 Recommended Scheduling

#### Brand Monitoring

- **Frequency:** Every 6-12 hours
- **Config:** `maxAgeHours: 12`, `analyzeSentiment: true`, `webhookUrl: "..."`

#### Subreddit Monitoring

- **Frequency:** Daily (every 24 hours)
- **Config:** `maxAgeHours: 24`, `minUpvotes: 5`

#### Trend Analysis

- **Frequency:** Weekly
- **Config:** `maxAgeHours: 168`, `maxItemsPerSubreddit: 500`, `includeComments: true`

#### Competitor Tracking

- **Frequency:** Daily
- **Config:** `maxAgeHours: 24`, `analyzeSentiment: true`, `webhookUrl: "..."`

### ❓ FAQ

#### How do I scrape Reddit without an API key?

This scraper accesses public Reddit data directly — no authentication, API keys, or Reddit account required.

#### Can I use this with n8n or Zapier?

Yes! Enable the `webhookUrl` parameter to send results directly to n8n, Zapier, or Make. The scraper posts a JSON payload with all results and stats at the end of each run.

#### How accurate is the sentiment analysis?

The sentiment analysis uses AFINN-165, a research-validated lexicon with ~2,500 words. Accuracy is typically 70-80% for social media text. Best for detecting overall positive/negative/neutral trends rather than nuanced emotion.

#### What's the difference between keyword and subreddit mode?

- **Keyword mode** searches all of Reddit (or specific subreddits) for posts matching keywords
- **Subreddit mode** monitors specific subreddits and optionally filters by keywords

For brand monitoring, use keyword mode. For community monitoring, use subreddit mode.

#### Can I schedule this to run automatically?

Yes! Use Apify's built-in scheduler or integrate with n8n/Zapier for custom schedules. We recommend running every 6-12 hours for brand monitoring, or daily for subreddit monitoring.

#### Will I get duplicate posts across runs?

No! The state management system tracks the last 10,000 post IDs seen. On subsequent runs, already-seen posts are automatically skipped. This is critical for scheduled automation.

#### Do I need to configure proxies?

No — the scraper uses residential proxies automatically. Reddit blocks datacenter IPs, so residential routing is built in for reliability (proxy bandwidth is billed separately by Apify).

#### How many posts can I scrape per run?

Technically unlimited, but Reddit's API typically returns ~1,000 posts per subreddit. Use `maxItemsPerSubreddit` to control volume and cost.

#### Can I scrape private subreddits?

No, the unofficial JSON API only accesses public subreddits. Private/quarantined subreddits require authentication via Reddit's official API.

#### What format is the output?

JSON by default, but you can export to CSV, Excel, HTML, or XML. The output is flat (not deeply nested) for easy import to Google Sheets, databases, or automation tools.

### 🛠️ API Integration

#### Using Apify API (cURL)

```bash
curl -X POST https://api.apify.com/v2/acts/YOUR_USERNAME~reddit-scraper-pro/runs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchMode": "keyword",
    "keywords": ["Apify"],
    "maxItemsPerSubreddit": 50
  }'
```

#### Using Apify JavaScript Client

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('YOUR_USERNAME/reddit-scraper-pro').call({
  searchMode: 'keyword',
  keywords: ['Apify'],
  maxItemsPerSubreddit: 50,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Using Apify Python Client

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')

run = client.actor('YOUR_USERNAME/reddit-scraper-pro').call(
    run_input={
        'searchMode': 'keyword',
        'keywords': ['Apify'],
        'maxItemsPerSubreddit': 50,
    }
)

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

### 🧪 Testing & Development

#### Quick Test with Default Input

Just click "Start" or use `apify call` with no input:

```bash
apify call YOUR_USERNAME/reddit-scraper-pro
```

#### Local Development

```bash
cd reddit-scraper-pro
npm install
npm run build

## Test with pay-per-event billing
ACTOR_TEST_PAY_PER_EVENT=true ACTOR_USE_CHARGING_LOG_DATASET=true npm run dev
```

### 📝 Limitations

- **Rate Limits:** Reddit enforces ~60 requests/minute (handled automatically)
- **Historical Data:** Limited by Reddit's API (typically ~1,000 posts per subreddit)
- **Private Subreddits:** Cannot access private/quarantined subreddits
- **Deleted Content:** Cannot retrieve deleted posts/comments
- **Residential Proxies Required:** Datacenter IPs are blocked by Reddit
- **Public Data Only:** Accesses publicly available Reddit content; may need updates if Reddit changes its site

### 🤝 Support & Contact

- **Email:** via Apify
- **Issues:** Report bugs or request features via GitHub Issues
- **Documentation:** This README + inline code comments

### 💡 Success Story

**Use Case:** "Alert me when r/webdev mentions 'Apify'"

**Setup:**

```json
{
  "searchMode": "keyword",
  "keywords": ["Apify"],
  "subreddits": ["webdev"],
  "webhookUrl": "https://n8n.io/webhook/reddit-alerts",
  "analyzeSentiment": true,
  "maxAgeHours": 12
}
```

**Schedule:** Every 6 hours

**Result:** Instant Slack notifications when Apify is mentioned in r/webdev, with sentiment context (positive/negative/neutral). Perfect for brand monitoring and community engagement.

***

### 🔗 Explore More of Our Actors

#### 💬 Social Media & Community

| Actor | Description |
|-------|-------------|
| [Discord Scraper Pro](https://apify.com/webdatalabs/discord-scraper-pro) | Extract Discord messages and chat history for community insights |
| [YouTube Comments Harvester](https://apify.com/webdatalabs/youtube-comments-harvester) | Comprehensive YouTube comments scraper with channel-wide enumeration |
| [Alt Network Bundle](https://apify.com/webdatalabs/alt-network-bundle) | Scrape Bluesky and Mastodon posts for alternative social media research |

#### 🛒 E-commerce & Brand Monitoring

| Actor | Description |
|-------|-------------|
| [Shopify Scraper Pro](https://apify.com/webdatalabs/shopify-scraper-pro) | Extract Shopify product data for competitor and brand monitoring |
| [Etsy Scraper Pro](https://apify.com/webdatalabs/etsy-scraper-pro) | Fast Etsy product scraper with ratings and reviews |
| [Amazon Reviews Scraper](https://apify.com/webdatalabs/amazon-reviews-scraper) | Extract Amazon customer reviews for sentiment analysis |

#### 🏢 Business Intelligence

| Actor | Description |
|-------|-------------|
| [Indeed Salary Analyzer](https://apify.com/webdatalabs/indeed-salary-analyzer) | Get salary data for compensation benchmarking and market research |
| [Crunchbase Scraper](https://apify.com/webdatalabs/crunchbase-scraper) | Extract company data and funding information for business intelligence |

***

### 🏷️ SEO Keywords

Reddit scraper, Reddit data extraction, scrape Reddit posts, Reddit API alternative, Reddit comment scraper, Reddit sentiment analysis, Reddit brand monitoring, Reddit automation, extract Reddit data, Reddit web scraping, Reddit post scraper, Reddit data mining, Reddit competitor analysis, Reddit keyword tracking, Reddit subreddit monitor, how to scrape Reddit, Reddit market research, Reddit trend analysis, Reddit automation tool, n8n Reddit integration, Zapier Reddit scraper, Make Reddit automation

***

**Built with ❤️ by WebDataLabs** | Powered by Apify | [MIT License](LICENSE)

***

### 📬 Custom Solutions & Enterprise

Need a custom data feed, modified output format, or enterprise integration?

**Contact:** Furkanc58@gmail.com

I offer:

- Daily/weekly data feeds (Snowflake, S3, BigQuery, Google Sheets)
- Custom scrapers for platforms not yet covered
- White-label solutions for agencies
- Priority support and SLAs

*Response within 24-48 hours.*

### Leave a review

Is this actor saving you time? A quick review on the Store helps other people find it — and tells us which fields to add next. **[Rate this actor →](https://apify.com/webdatalabs/reddit-scraper-pro)**

### Legal Disclaimer

This actor is a general-purpose tool for analyzing publicly accessible web data. The user bears sole responsibility for ensuring their specific use complies with:

- Applicable laws (GDPR/DSGVO, copyright law)
- The target website's Terms of Service
- Apify's Terms of Service

The provider (webdatalabs) expressly disclaims liability for any unauthorized or unlawful use. By using this actor, the user agrees to indemnify the provider against any third-party claims arising from their use of the data.

***

*This tool is not affiliated with Reddit. All trademarks belong to their respective owners.*

# Actor input Schema

## `searchMode` (type: `string`):

Keyword Search looks across all of Reddit (or inside the subreddits you list) using Reddit's search engine. Subreddit Monitoring works inside specific communities and REQUIRES at least one subreddit below.

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

What to search for. Required in Keyword Search mode. In Subreddit Monitoring mode: leave empty to get the newest posts of each community, or add keywords to search each community for them (multi-word keywords are searched as a phrase, matching post titles and post bodies). Reddit's search engine decides what matches; the keywords\_matched output field tells you which keywords literally appear in each post.

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

Communities to scrape, with or without the 'r/' prefix (e.g. 'webdev' or 'r/webdev'). REQUIRED when Search Mode is Subreddit Monitoring. In Keyword Search mode this is optional: leave it empty to search all of Reddit, or list subreddits to restrict the search to them.

## `maxItemsPerSubreddit` (type: `integer`):

Hard cap on how many posts are fetched, saved and charged. In Subreddit Monitoring mode this is the budget per subreddit (shared across your keywords). In Keyword Search mode it is the budget per keyword per subreddit. Filters below can reduce the final count further, never increase it.

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

How Reddit sorts keyword-search results. Applies to Keyword Search mode only - Subreddit Monitoring always fetches the newest matching posts first.

## `maxAgeHours` (type: `integer`):

Only keep posts newer than this. 0 = no age limit. Posts older than the limit are fetched and then dropped, so a tight limit combined with a large Max Posts value can return far fewer rows than the cap - the run log reports exactly how many were dropped for being too old.

## `minUpvotes` (type: `integer`):

Only keep posts with at least this many upvotes. 0 captures every mention (best for brand monitoring); raise it to filter noise.

## `includeComments` (type: `boolean`):

Fetch the comment thread of every saved post. Costs one extra request per saved post, so runs take noticeably longer. Keep off unless you need comment data.

## `commentDepth` (type: `integer`):

Levels of nested replies to fetch (0 = top-level comments only, 2 = replies to replies). Ignored when Scrape Comments is off.

## `analyzeSentiment` (type: `boolean`):

Score each post with AFINN-165 sentiment analysis, adding sentiment\_score and sentiment\_label (positive/negative/neutral). Useful for brand monitoring.

## `dedupeAcrossRuns` (type: `boolean`):

For scheduled monitoring: remember which posts were already delivered and skip (and never re-charge) them on the next run with the same subreddits and keywords. Leave off for one-off runs - with it on, a repeated run can legitimately return zero new posts.

## `webhookUrl` (type: `string`):

Send the results to n8n, Zapier or a custom endpoint. The batch is POSTed as JSON when the run completes. Example: https://your-n8n.com/webhook/reddit-alerts

## Actor input object example

```json
{
  "searchMode": "keyword",
  "keywords": [
    "AI",
    "ChatGPT",
    "web scraping"
  ],
  "subreddits": [
    "webdev",
    "programming",
    "technology"
  ],
  "maxItemsPerSubreddit": 50,
  "searchSort": "relevance",
  "maxAgeHours": 0,
  "minUpvotes": 0,
  "includeComments": false,
  "commentDepth": 1,
  "analyzeSentiment": true,
  "dedupeAcrossRuns": false
}
```

# Actor output Schema

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

No description

## `engagement_analysis` (type: `string`):

No description

## `full_data` (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 = {
    "keywords": [
        "AI",
        "ChatGPT",
        "web scraping"
    ],
    "subreddits": [
        "webdev",
        "programming",
        "technology"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("webdatalabs/reddit-scraper-pro").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 = {
    "keywords": [
        "AI",
        "ChatGPT",
        "web scraping",
    ],
    "subreddits": [
        "webdev",
        "programming",
        "technology",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("webdatalabs/reddit-scraper-pro").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 '{
  "keywords": [
    "AI",
    "ChatGPT",
    "web scraping"
  ],
  "subreddits": [
    "webdev",
    "programming",
    "technology"
  ]
}' |
apify call webdatalabs/reddit-scraper-pro --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/fHB0Fyn0WFjnvzKpf/builds/snwNYDePwqdtfq6yg/openapi.json
