# Reddit Scraper — Posts, Comments & Search (`crabwalker/reddit-scraper`) Actor

Scrape public Reddit posts, comments, communities, users, and search results into structured datasets.

- **URL**: https://apify.com/crabwalker/reddit-scraper.md
- **Developed by:** [Crab Walker](https://apify.com/crabwalker) (community)
- **Categories:** Social media, News
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 97.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 reddit 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/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 — Posts, Comments, Communities & Users

Fast, API-key-free extraction of public Reddit data. The Actor accepts the same
input names and emits the same core output fields as
`trudax/reddit-scraper-lite`, so existing Apify tasks and integrations can move
over without remapping.

It supports:

- subreddit, listing, post, search, and user URLs
- keyword searches for posts, comments, communities, users, and media
- nested comment threads
- pagination with independent post, comment, community, and user limits
- newest, relevance, hot, top, rising, comments, and time-window sorting
- post and comment date cutoffs for incremental collection
- NSFW filtering, deduplication, media/gallery extraction, retries, and proxies
- a public RSS fallback when Reddit blocks JSON listing endpoints
- a Jina Reader fallback for public community/profile discovery when Reddit
  rejects all available cloud and proxy IPs

The Actor uses lightweight HTTP requests rather than a browser. Detailed Reddit
JSON responses provide engagement and media fields; when Reddit only permits
RSS, the Actor still returns compatible records but fields unavailable in RSS
are `null`.

Community, profile, and keyword-comment search terms are sent to the public Jina
Reader service because Reddit rejects these search pages from Apify cloud and
proxy IP ranges. No credentials or private Reddit data are sent.

### Input

Provide at least one `startUrls` item or one `searches` term:

```json
{
  "startUrls": [
    { "url": "https://www.reddit.com/r/webscraping/new/" }
  ],
  "maxItems": 100,
  "maxPostCount": 100,
  "skipCommunity": false,
  "proxy": {
    "useApifyProxy": true
  }
}
```

Search example:

```json
{
  "searches": ["web scraping"],
  "searchPosts": true,
  "searchComments": true,
  "searchCommunities": true,
  "sort": "new",
  "time": "month",
  "postDateLimit": "2026-07-01T00:00:00Z",
  "maxItems": 500
}
```

When `startUrls` is non-empty, search fields are ignored, matching the reference
Actor. Set `ignoreStartUrls` to `true` for integrations that retain a prefilled
URL.

### Output

Every dataset item has a `dataType` of `post`, `comment`, `community`, or
`user`. Compatible fields include:

```json
{
  "id": "t3_abc123",
  "parsedId": "abc123",
  "url": "https://www.reddit.com/r/example/comments/abc123/example/",
  "username": "alice",
  "userId": "t2_xyz",
  "title": "Example",
  "communityName": "r/example",
  "parsedCommunityName": "example",
  "body": "Post text",
  "html": "<div class=\"md\"><p>Post text</p></div>",
  "numberOfComments": 12,
  "upVotes": 42,
  "upVoteRatio": 0.95,
  "imageUrls": [],
  "videoUrls": [],
  "createdAt": "2026-07-23T01:00:00.000Z",
  "scrapedAt": "2026-07-23T01:01:00.000Z",
  "dataType": "post"
}
```

`SUMMARY` in the default key-value store reports result counts by type, request
count, and whether `maxItems` stopped the run.

### Local development

```bash
npm install
npm test
npm run smoke
npm start
```

The checked-in local `INPUT.json` runs a three-result live subreddit test with
direct requests and exercises the RSS fallback. Use an Apify or custom proxy
for detailed JSON, community profiles, user profiles, and heavily rate-limited
comment threads.

### Pricing

The intended model is pay per stored result with platform usage included.
See [PRICING.md](./PRICING.md) for the exact Console events, initial price, and
the calculator that preserves an 80% markup after Apify's 20% commission.

### Responsible use

Scrape only public data. Respect Reddit's terms, applicable law, personal-data
requirements, and reasonable request rates. This Actor does not bypass login,
private communities, quarantines, or access controls.

# Actor input Schema

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

Reddit post, subreddit, listing, search, or user URLs. When supplied, search fields are ignored unless Ignore start URLs is enabled.

## `skipComments` (type: `boolean`):

Do not extract comments from post URLs.

## `skipUserPosts` (type: `boolean`):

Do not extract activity from user profile URLs.

## `skipCommunity` (type: `boolean`):

Do not save community details when scraping a subreddit URL.

## `includeMediaLinks` (type: `boolean`):

Kept for input compatibility. This Actor always extracts all details available in Reddit's public response without an extra request.

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

One or more Reddit search queries.

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

Restrict post and comment searches to this subreddit, without the r/ prefix.

## `ignoreStartUrls` (type: `boolean`):

Ignore startUrls and use searches. Useful for integrations that keep a prefilled URL.

## `searchPosts` (type: `boolean`):

Return posts matching each search term.

## `searchComments` (type: `boolean`):

Return comments matching each search term when Reddit exposes comment search.

## `searchCommunities` (type: `boolean`):

Return subreddit communities matching each search term.

## `searchUsers` (type: `boolean`):

Return Reddit user profiles matching each search term.

## `searchMedia` (type: `boolean`):

Search posts and retain only results containing images or video.

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

Sort Reddit search and listing results.

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

Restrict top/search posts to the selected time window.

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

Include posts and communities marked over 18.

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

Global dataset limit across posts, comments, communities, and users.

## `maxPostCount` (type: `integer`):

Maximum posts saved from each subreddit, user, listing, or search.

## `postDateLimit` (type: `string`):

Only save posts created on or after this ISO date/time. Forces newest-first listing order.

## `commentDateLimit` (type: `string`):

Only save comments created on or after this ISO date/time.

## `maxComments` (type: `integer`):

Maximum comments saved from each post, user page, or comment search.

## `maxCommunitiesCount` (type: `integer`):

Maximum communities saved for each community search.

## `maxUserCount` (type: `integer`):

Maximum users saved for each user search.

## `scrollTimeout` (type: `integer`):

Compatibility field. Used as the request timeout for the HTTP implementation.

## `proxy` (type: `object`):

Apify proxy or custom proxy configuration. Direct requests are used when useApifyProxy is false.

## `debugMode` (type: `boolean`):

Log request-level diagnostic details.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/webscraping/new/"
    }
  ],
  "skipComments": false,
  "skipUserPosts": false,
  "skipCommunity": false,
  "includeMediaLinks": false,
  "ignoreStartUrls": false,
  "searchPosts": true,
  "searchComments": false,
  "searchCommunities": false,
  "searchUsers": false,
  "searchMedia": false,
  "sort": "new",
  "time": "all",
  "includeNSFW": true,
  "maxItems": 10,
  "maxPostCount": 10,
  "maxComments": 10,
  "maxCommunitiesCount": 2,
  "maxUserCount": 2,
  "scrollTimeout": 40,
  "proxy": {
    "useApifyProxy": true
  },
  "debugMode": false
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/webscraping/new/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("crabwalker/reddit-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/new/" }] }

# Run the Actor and wait for it to finish
run = client.actor("crabwalker/reddit-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 '{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/webscraping/new/"
    }
  ]
}' |
apify call crabwalker/reddit-scraper --silent --output-dataset

```

## MCP server setup

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