# Reddit Scraper for AI Agents: Posts, Search, Comments (`henrycrawl/reddit-scraper-llm`) Actor

Scrape public Reddit subreddits, search results, posts and threaded comments into clean, LLM-ready JSON: title, score, upvote ratio, comment count, ISO time, flair, body. No login, no API key, no author names. Pay per post.

- **URL**: https://apify.com/henrycrawl/reddit-scraper-llm.md
- **Developed by:** [Henry Crawl](https://apify.com/henrycrawl) (community)
- **Categories:** AI, Social media, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 posts

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/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 Scraper for AI Agents: Posts, Search, Comments

Scrape **public Reddit** subreddits, search results, single posts and their comments into clean, strictly typed JSON that an LLM or AI agent can use directly. No login, no API key, no Reddit app registration.

- **Subreddits**: hot, new, top, rising, controversial (with time range).
- **Search**: all of Reddit, by relevance, hot, top, new or most comments, with a time range.
- **Posts**: paste any post URL to get the post and its discussion.
- **Comments**: optional for every post (threaded: `depth`, `parentId`).

Privacy by design: **author names are never collected** (posts or comments). You get what analysis needs: text, score, timing and structure.

### Output (one row per post)

| Field | Meaning |
|---|---|
| `id`, `url`, `title`, `subreddit` | identity of the post |
| `score`, `upvoteRatio`, `commentCount` | engagement |
| `createdAt` | ISO 8601 time |
| `postType`, `domain`, `contentUrl`, `flair`, `language` | what the post is |
| `body` | self-text (`bodyIsSnippet: true` for search results, which show a preview only) |
| `comments` | `[{id, parentId, depth, score, createdAt, permalink, text}]` |
| `missingFields` | key fields Reddit did not expose for this post |
| `source` | `{type, input, rank}`: where the post came from |

Failed inputs come back as **free** error rows with a clear `status` (`INVALID_URL`, `NOT_FOUND`, `PRIVATE`, `EMPTY`, `BLOCKED`).

### Input example

```json
{
  "subreddits": ["LocalLLaMA", "r/python"],
  "sort": "top",
  "time": "week",
  "searchQueries": ["best budget mechanical keyboard"],
  "startUrls": ["https://www.reddit.com/r/AskReddit/comments/1abcde/example/"],
  "maxPostsPerSource": 50,
  "maxCommentsPerPost": 20
}
```

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` | $0.01 per run |
| `post` | **$2.00 / 1,000 posts** |
| `comment` | **$0.50 / 1,000 comments** |

Residential proxy and a real browser are included. Error rows and duplicates are free.

### FAQ

**Is it legal?** The actor reads only public pages that any logged-out visitor can see, at a polite rate, and does not collect usernames. You are responsible for how you use the data and for complying with Reddit's terms and the laws of your country.

**Why a browser and not the Reddit API?** Reddit's API needs an approved app and has strict commercial terms; this actor reads the public website like a visitor.

**NSFW / private / quarantined communities?** Only what a logged-out visitor sees. Private communities return a free `PRIVATE` row.

# Actor input Schema

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

Subreddit names or URLs, e.g. technology, r/python or https://www.reddit.com/r/LocalLLaMA/.

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

Order of subreddit posts.

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

Time window when sort is top or controversial.

## `searchQueries` (type: `array`):

Search all of Reddit for posts matching these keywords.

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

Order of search results.

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

Only posts from this period (search only).

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

Any mix of subreddit URLs, post URLs (returns the post with its comments) and reddit.com/search?q=... URLs.

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

Maximum posts from each subreddit / search (1-1000). Duplicates are output once.

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

Public comments to add to each post from subreddits / search (0 = none, max 500). Post URLs always include up to 100 comments. Comment authors are not collected.

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

Reddit blocks datacenter IPs. Default: Apify residential proxy, United States (included in the price).

## Actor input object example

```json
{
  "subreddits": [
    "technology"
  ],
  "sort": "top",
  "time": "week",
  "searchSort": "relevance",
  "searchTime": "all",
  "maxPostsPerSource": 10,
  "maxCommentsPerPost": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

Post rows (with optional comments) and free error rows.

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

Counts per status for this run (SUMMARY record).

# 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 = {
    "subreddits": [
        "technology"
    ],
    "sort": "top",
    "maxPostsPerSource": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("henrycrawl/reddit-scraper-llm").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 = {
    "subreddits": ["technology"],
    "sort": "top",
    "maxPostsPerSource": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("henrycrawl/reddit-scraper-llm").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 '{
  "subreddits": [
    "technology"
  ],
  "sort": "top",
  "maxPostsPerSource": 10
}' |
apify call henrycrawl/reddit-scraper-llm --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,henrycrawl/reddit-scraper-llm"
        }
    }
}
```

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/9WNso4eZeKLZeBE1u/builds/q8jradYIAQGrK8kVo/openapi.json
