# Reddit Comments Search Scraper (`api-empire/reddit-comments-search-scraper`) Actor

- **URL**: https://apify.com/api-empire/reddit-comments-search-scraper.md
- **Developed by:** [API Empire](https://apify.com/api-empire) (community)
- **Categories:** Automation, Lead generation, Social media
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Search Scraper

Scrape **Reddit search results and subreddit listings at scale** — paste any Reddit URL (search, subreddit, or subreddit search) and the actor paginates Reddit's public JSON API, returns clean structured records, and live-saves each post to the dataset.

> 💡 Built for marketers, researchers, AI/LLM data pipelines, and competitive-intelligence teams who need clean, structured Reddit data without scraping headaches.

---

### ✨ Why choose this Actor?

- 🚀 **Fast** — pure async HTTP, no headless browser overhead.
- 🛡️ **Smart proxy ladder** — starts direct, auto-falls-back to **datacenter → residential** on 403/429/blocked responses, and stays on residential once it kicks in.
- 🔁 **Resilient** — per-request retries with jittered backoff, and 3 retries on the residential tier before giving up.
- 💾 **Live saving** — every post is pushed to the dataset as it's scraped, so a mid-run crash never loses work.
- 🧱 **Bulk URLs** — feed it any number of Reddit URLs in one run.
- 📊 **Pre-built dataset views** — Overview, Post, Subreddit, Author, Content, and Full Record tabs in the Apify Console.

---

### 🎯 Key features

- 🌐 Bulk URL input (search URLs, subreddit URLs, subreddit search URLs)
- 🔎 Optional keyword fallback when no URLs are supplied
- 📊 Sort by **Relevance / Hot / Top / New / Most Comments**
- 🔞 Safe-search toggle
- 📦 Hard cap on total items via `maxItems`
- 🛡️ Default no-proxy, auto-escalating fallback ladder
- 📝 Detailed real-time logs so you can watch progress live

---

### 📥 Input

```json
{
  "urls": [
    { "url": "https://www.reddit.com/search/?q=ai&sort=new" },
    { "url": "https://www.reddit.com/r/python/" }
  ],
  "query": "artificial intelligence",
  "sort": "relevance",
  "safeSearch": "off",
  "maxItems": 300,
  "maxRetries": 3,
  "proxyConfiguration": { "useApifyProxy": false }
}
````

| Field | Type | Description |
|---|---|---|
| `urls` | array | Reddit URLs to scrape (search, subreddit, or subreddit search). |
| `query` | string | Keyword fallback used only when `urls` is empty. |
| `sort` | enum | `relevance` / `hot` / `top` / `new` / `comments`. |
| `safeSearch` | enum | `off` (include NSFW) or `on` (hide NSFW). |
| `maxItems` | integer | Hard cap on total posts across all URLs. |
| `maxRetries` | integer | Per-request retries before escalating proxy tier. |
| `proxyConfiguration` | object | Standard Apify proxy input. Defaults to no proxy. |

***

### 📤 Output

Each dataset record matches the original reference shape exactly, plus a few top-level mirror fields so the table views work without nested-path lookups:

```json
{
  "post": {
    "title": "The more young people use AI, the more they hate it",
    "url": "https://www.reddit.com/r/technology/comments/1szusu6/the_more_young_people_use_ai_the_more_they_hate_it/",
    "score": 22036,
    "comment_count": 1612
  },
  "subreddit": { "name": "technology" },
  "author":    { "name": "spherocytes" },
  "contentText": "",
  "content_type": "link",
  "created_timestamp": "2026-04-30T12:34:21.000000+0000",

  "title": "The more young people use AI, the more they hate it",
  "subreddit_name": "technology",
  "author_name": "spherocytes",
  "score": 22036,
  "comment_count": 1612,
  "url": "https://www.reddit.com/r/technology/comments/1szusu6/the_more_young_people_use_ai_the_more_they_hate_it/"
}
```

***

### 🚀 How to use the Actor (via Apify Console)

1. 🔐 Log in at [console.apify.com](https://console.apify.com) → **Actors**.
2. 🔎 Find **Reddit Search Scraper** and open it.
3. 📝 Paste one or more Reddit URLs (or type a keyword in the `query` field).
4. ⚙️ Pick a `sort` (Relevance / Hot / Top / New / Most Comments) and set `maxItems`.
5. 🛡️ Leave **Proxy** on default (no proxy) — the scraper auto-escalates if Reddit pushes back.
6. ▶️ Click **Start**.
7. 📊 Watch logs in real time; open the **Output** tab as records stream in.
8. 📁 Export to JSON / CSV / Excel.

***

### 🛡️ Proxy strategy

The scraper uses a three-tier ladder:

| Tier | When it's used |
|---|---|
| 🌐 **Direct** | Default — Reddit's public JSON API rarely needs a proxy. |
| 🏢 **Datacenter** | Auto-engaged if direct requests get 403 / 429 / blocked. |
| 🏠 **Residential** | Auto-engaged if datacenter still fails. Retries up to 3× then sticks for the rest of the run. |

You can also start higher up the ladder by selecting a proxy group in the input.

***

### 💼 Best use cases

- 🤖 Building AI / LLM training datasets from Reddit discussion
- 📊 Brand monitoring & sentiment analysis
- 🧠 Market research and competitive intelligence
- 📝 Content trend discovery
- 🔬 Academic research on online communities

***

### ❓ Frequently asked questions

**Q: Does it scrape comments?**
A: This actor returns post-level metadata (title, score, comment count, body text). For per-post comment threads, use an additional actor or extend this one to fetch `<permalink>.json`.

**Q: Does it support private subreddits?**
A: No — only publicly accessible subreddits and search results.

**Q: What happens if Reddit blocks me?**
A: The scraper auto-escalates the proxy tier and retries. If even residential fails after 3 retries, the run ends with a clear status message.

***

### 📨 Support and feedback

For issues, custom features, or feedback: **dev.scraperengine@gmail.com**

***

### ⚠️ Legal & ethical use

- Only collect data from **publicly accessible** Reddit pages.
- Respect Reddit's terms of service and applicable privacy laws (GDPR / CCPA).
- The end user is responsible for downstream use of the data.

# Actor input Schema

## `urls` (type: `array`):

One or more Reddit URLs. Supports:
• Search URLs — https://www.reddit.com/search/?q=ai\&sort=new
• Subreddit URLs — https://www.reddit.com/r/python/
• Subreddit search URLs — https://www.reddit.com/r/python/search/?q=django\&restrict\_sr=1

Leave empty if you want to use the keyword field below instead.

## `query` (type: `string`):

Keyword to search across all of Reddit. Used only when the URLs field above is empty. Example: 'artificial intelligence'.

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

How Reddit orders the search results.
• Relevance — best match to the query
• Hot — trending now
• Top — highest score
• New — newest first
• Comments — most comments

## `safeSearch` (type: `string`):

Whether to include NSFW (over-18) posts in the results.

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

Hard cap on the total number of posts returned across all input URLs. Reddit's search API returns up to 25 posts per request and the scraper paginates until this cap is reached.

## `maxRetries` (type: `integer`):

How many times to retry a failed Reddit API request (per proxy tier) before falling back to the next tier.

## `proxyConfiguration` (type: `object`):

Default is no proxy — Reddit's public JSON API rarely needs one. If Reddit returns 403/429/blocked, the scraper auto-escalates: direct → datacenter → residential (retries 3 times on residential). Once it falls back to residential, it stays there for the rest of the run.

## Actor input object example

```json
{
  "urls": [
    "https://www.reddit.com/search/?q=ai&sort=relevance"
  ],
  "sort": "relevance",
  "safeSearch": "off",
  "maxItems": 10,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": 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 = {
    "urls": [
        "https://www.reddit.com/search/?q=ai&sort=relevance"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-empire/reddit-comments-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 = {
    "urls": ["https://www.reddit.com/search/?q=ai&sort=relevance"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("api-empire/reddit-comments-search-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 '{
  "urls": [
    "https://www.reddit.com/search/?q=ai&sort=relevance"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call api-empire/reddit-comments-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Comments Search Scraper",
        "description": null,
        "version": "0.1",
        "x-build-id": "JgFXljsjYrgkceRgX"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/api-empire~reddit-comments-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-api-empire-reddit-comments-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/api-empire~reddit-comments-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-api-empire-reddit-comments-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/api-empire~reddit-comments-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-api-empire-reddit-comments-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "urls": {
                        "title": "🌐 Reddit URLs (bulk)",
                        "type": "array",
                        "description": "One or more Reddit URLs. Supports:\n• Search URLs — https://www.reddit.com/search/?q=ai&sort=new\n• Subreddit URLs — https://www.reddit.com/r/python/\n• Subreddit search URLs — https://www.reddit.com/r/python/search/?q=django&restrict_sr=1\n\nLeave empty if you want to use the keyword field below instead.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "query": {
                        "title": "🔎 Search Query (fallback)",
                        "type": "string",
                        "description": "Keyword to search across all of Reddit. Used only when the URLs field above is empty. Example: 'artificial intelligence'."
                    },
                    "sort": {
                        "title": "📊 Sort By",
                        "enum": [
                            "relevance",
                            "hot",
                            "top",
                            "new",
                            "comments"
                        ],
                        "type": "string",
                        "description": "How Reddit orders the search results.\n• Relevance — best match to the query\n• Hot — trending now\n• Top — highest score\n• New — newest first\n• Comments — most comments",
                        "default": "relevance"
                    },
                    "safeSearch": {
                        "title": "🔞 Safe Search",
                        "enum": [
                            "off",
                            "on"
                        ],
                        "type": "string",
                        "description": "Whether to include NSFW (over-18) posts in the results.",
                        "default": "off"
                    },
                    "maxItems": {
                        "title": "📦 Maximum Items",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Hard cap on the total number of posts returned across all input URLs. Reddit's search API returns up to 25 posts per request and the scraper paginates until this cap is reached.",
                        "default": 10
                    },
                    "maxRetries": {
                        "title": "🔁 Max Retries Per Request",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How many times to retry a failed Reddit API request (per proxy tier) before falling back to the next tier.",
                        "default": 3
                    },
                    "proxyConfiguration": {
                        "title": "🛡️ Proxy Configuration",
                        "type": "object",
                        "description": "Default is no proxy — Reddit's public JSON API rarely needs one. If Reddit returns 403/429/blocked, the scraper auto-escalates: direct → datacenter → residential (retries 3 times on residential). Once it falls back to residential, it stays there for the rest of the run.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
