# Reddit Scraper (`jimmy-o/reddit-scraper`) Actor

Collect posts and comments from any subreddit or Reddit search through Reddit's official OAuth API with your own free app credentials (2-minute setup). No proxies, no author usernames. Free while in launch promo.

- **URL**: https://apify.com/jimmy-o/reddit-scraper.md
- **Developed by:** [Omar Gamal](https://apify.com/jimmy-o) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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

This Reddit Scraper collects posts (and optionally their top comments) from any
subreddit or a Reddit search - through **Reddit's official API only**. No
headless browsers, no proxies, nothing that gets you blocked.

**Free while in launch promo.** Comparable Reddit actors charge $2-4 per 1,000
results; this one costs you a few seconds of Apify compute per run.

### Setup (2 minutes, free, required)

Reddit blocks unauthenticated API calls from cloud IPs, so the actor runs with
**your own free Reddit app credentials** - Reddit's official, sanctioned way
in. There is no credential-free mode; this is Reddit's rule:

1. Go to [reddit.com/prefs/apps](https://www.reddit.com/prefs/apps) and click
   **create app** (type: **script**; any name, redirect URI `http://localhost`).
2. Copy the **client ID** (shown under the app name) and the **secret**.
3. Paste both into this actor's inputs and run.

The actor then uses Reddit's official OAuth API (100 requests/minute for your
app) - exactly what the paid alternatives do, minus the fee.

### Input

| Field | Notes |
| --- | --- |
| Subreddits | e.g. `["technology", "Egypt"]` |
| Search query | Optional; searches all of Reddit, or the single subreddit given |
| Listing | hot, new, top, rising, controversial (when not searching) |
| Time filter | For top / controversial / search |
| Max posts | Up to 1,000 per run |
| Include comments | Adds top comments per post |
| Client ID / secret | Required, see above |

### Example

Subreddits `["dubai"]`, listing `new`, max posts 100: the 100 newest posts from
r/dubai with title, text, score, comment count, flair and links.

### Output per post

Subreddit, title, text, score, upvote ratio, comment count, post time, Reddit
link, content URL, flair, NSFW flag - plus a `comments` array (body, score,
time) when enabled.

**Privacy by design:** author usernames are never collected.

### FAQ

**Why does it need my own app?** Reddit's API terms require a registered app
per user; it takes two minutes and is free.
**Rate limits?** Your app gets 100 requests/minute, which the actor respects.
**Can it scrape without credentials?** No - Reddit hard-blocks that from cloud
IPs, and this actor does not work around blocks.

### Cost

The actor is free. A 100-post run uses well under $0.01 of Apify compute.

### More free scrapers from jimmy-o

- [UAE Real Estate Scraper](https://apify.com/jimmy-o/uae-real-estate-listings)
- [Saudi Real Estate Scraper](https://apify.com/jimmy-o/saudi-real-estate-listings)
- [Facebook Ads Library Scraper](https://apify.com/jimmy-o/facebook-ads-library)
- [YouTube Scraper](https://apify.com/jimmy-o/youtube-scraper)

# Actor input Schema

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

Subreddit names without r/, e.g. \["technology", "Egypt"]. Used for browsing listings, and to scope a search when exactly one is given.

## `searchQuery` (type: `string`):

Optional. When set, search Reddit for posts matching this query instead of browsing a listing. Scoped to the subreddit if exactly one is given above.

## `listing` (type: `string`):

Which listing to browse when no search query is set.

## `timeFilter` (type: `string`):

Applies to top, controversial and search.

## `maxPosts` (type: `integer`):

Stop after this many posts in total (1-1000).

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

Also collect top comments for each post (adds one request per post).

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

How many comments to collect per post when comments are enabled (0-100).

## `clientId` (type: `string`):

Required in practice: Reddit blocks unauthenticated API calls from cloud IPs. Create a free app at reddit.com/prefs/apps (type: script) and paste its client ID. Takes 2 minutes - see README.

## `clientSecret` (type: `string`):

The secret of the Reddit app above. Stored encrypted; never logged.

## Actor input object example

```json
{
  "subreddits": [
    "technology"
  ],
  "searchQuery": "",
  "listing": "hot",
  "timeFilter": "week",
  "maxPosts": 25,
  "includeComments": false,
  "maxCommentsPerPost": 10,
  "clientId": ""
}
```

# Actor output Schema

## `results` (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 = {};

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

# Run the Actor and wait for it to finish
run = client.actor("jimmy-o/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 '{}' |
apify call jimmy-o/reddit-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jimmy-o/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/Neuh22TTDZonIdMlC/builds/8TRh2wdzdFL7JOQgL/openapi.json
