# Reddit Scraper — Posts, Comments & Search (No API Key) (`gochujang/reddit-posts-scraper`) Actor

Scrape Reddit posts and comments from any subreddit, search query, or user profile. Uses Reddit public JSON API — no API key required. Sort by hot/new/top/rising. Optional top comments. PPE $0.003/post.

- **URL**: https://apify.com/gochujang/reddit-posts-scraper.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.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?

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 Posts & Comments Scraper

Scrape Reddit posts and comments from any subreddit, search query, or user profile — **no API key required**. Uses Reddit's public JSON API with smart pagination.

### Features

- **Subreddit scraping** — collect posts from any public subreddit (e.g. `python`, `machinelearning`, `technology`)
- **Reddit search** — global keyword search across all of Reddit
- **User profile scraping** — collect posts submitted by specific users
- **Sort by** hot / new / top / rising / controversial
- **Time filter** for top/controversial: hour / day / week / month / year / all time
- **Top comments** — optionally fetch the top N comments per post
- **NSFW filtering** — skip adult content by default
- **Bulk input** — pass multiple subreddits and users in one run
- **Keyless** — zero API credentials needed

### Output Fields

| Field | Description |
|-------|-------------|
| `post_id` | Reddit post ID (e.g. `abc123`) |
| `title` | Post title |
| `subreddit` | Subreddit name |
| `author` | Reddit username |
| `score` | Net upvotes |
| `upvote_ratio` | Fraction of upvotes (0–1) |
| `num_comments` | Total comments on post |
| `flair` | Post flair label |
| `is_nsfw` | Over-18 flag |
| `url` | External link URL (or reddit.com for text posts) |
| `permalink` | Full reddit.com URL to the post |
| `created_utc` | Post creation time (ISO 8601 UTC) |
| `selftext_preview` | First 500 chars of post body |
| `thumbnail` | Thumbnail image URL (if available) |
| `domain` | Link domain |
| `awards` | Number of Reddit awards |
| `source_type` | `subreddit` / `search` / `user` |
| `source` | Source identifier (e.g. `r/python`) |
| `top_comments` | Array of top comments (when enabled) |

### Example Input

```json
{
  "subreddits": ["python", "machinelearning"],
  "sort": "top",
  "timeFilter": "week",
  "maxPostsPerSource": 100,
  "includeComments": true,
  "maxCommentsPerPost": 5,
  "skipNsfw": true
}
```

Scrape the top 100 posts from r/python and r/machinelearning this week, including top 5 comments per post.

#### Search example

```json
{
  "searchQuery": "ChatGPT alternative",
  "sort": "new",
  "maxPostsPerSource": 200
}
```

#### User profile example

```json
{
  "usernames": ["spez", "kn0thing"],
  "sort": "top",
  "timeFilter": "all",
  "maxPostsPerSource": 50
}
```

### Pricing

| Event | Price |
|-------|-------|
| Actor start | $0.005 (once) |
| Per post scraped | $0.003 |

Example: 1,000 posts = **$3.005** total.

### Rate Limits

Reddit's public JSON API allows approximately 1 request/second for anonymous access. The scraper respects this automatically. For very large jobs (10,000+ posts), consider scheduling multiple smaller runs.

### No API Key Needed

This actor uses Reddit's publicly accessible JSON API (append `.json` to any Reddit URL). No OAuth app, no Reddit account, no API key.

### Use Cases

- **Sentiment analysis** — collect posts about a product/brand/topic
- **Research** — gather data from niche communities
- **Content monitoring** — track trending discussions
- **Lead generation** — find relevant threads in business subreddits
- **AI training data** — collect community discussions at scale

### Notes

- Deleted/removed posts are excluded automatically
- Reddit limits free API to ~1,000 posts per sort order per subreddit
- Private and quarantined subreddits are not accessible

### Setup Requirements

Reddit blocks direct requests from datacenter IP addresses. To use this actor, you need one of:

#### Option A: Apify Proxy (Recommended)

Use the `proxyConfiguration` input field with `"useApifyProxy": true`. Apify Proxy routes requests through residential IPs that Reddit allows. Proxy costs are separate from actor usage costs.

```json
{
  "subreddits": ["python"],
  "proxyConfiguration": {"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}
}
```

#### Option B: Your Own Reddit App Credentials

Create a free Reddit app at [reddit.com/prefs/apps](https://www.reddit.com/prefs/apps) (type: "script"). Then pass your `client_id` and `client_secret` via the `redditClientId` and `redditClientSecret` input fields.

```json
{
  "subreddits": ["python"],
  "redditClientId": "your_client_id",
  "redditClientSecret": "your_client_secret"
}
```

> **Why is this needed?** Reddit's API blocks direct access from server IPs (a common restriction with many scraping targets). Using a proxy or official API credentials is the standard approach used by all production Reddit scrapers.

**Keywords:** Reddit scraper, subreddit, Reddit posts, comments, Reddit API, social media scraper, Reddit data, Reddit search

# Actor input Schema

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

List of subreddits to scrape (e.g. 'python', 'machinelearning'). Include r/ prefix or not.

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

Reddit search query. If set, searches Reddit globally (or within subreddit if subreddits is also set).

## `usernames` (type: `array`):

Scrape posts from specific Reddit users (e.g. 'spez', 'kn0thing').

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

Sort posts by: hot, new, top, rising, controversial.

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

Time period for top/controversial sort: hour, day, week, month, year, all.

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

Maximum number of posts to collect per subreddit/user/search. Max 1000.

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

If enabled, fetches the top comments for each post (up to maxCommentsPerPost).

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

Number of top-level comments to fetch per post when includeComments is enabled.

## `skipNsfw` (type: `boolean`):

Skip posts marked as NSFW (over 18).

## `redditClientId` (type: `string`):

Optional Reddit app client\_id for higher rate limits. Get one at https://www.reddit.com/prefs/apps (type: script). Leave empty to use the built-in credential.

## `redditClientSecret` (type: `string`):

Optional Reddit app client\_secret for your registered app. Leave empty to use built-in credential.

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

Proxy settings for bypassing Reddit IP restrictions. Uses Apify Proxy by default.

## Actor input object example

```json
{
  "subreddits": [],
  "searchQuery": "",
  "usernames": [],
  "sort": "hot",
  "timeFilter": "week",
  "maxPostsPerSource": 100,
  "includeComments": false,
  "maxCommentsPerPost": 5,
  "skipNsfw": true,
  "redditClientId": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/reddit-posts-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("gochujang/reddit-posts-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 gochujang/reddit-posts-scraper --silent --output-dataset

```

## MCP server setup

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