# Cheapest Reddit Scraper API (`xxoo/cheapest-reddit-scraper-api`) Actor

Scrape Reddit subreddit posts, post details, comments, search results, and user profiles via the public JSON API. Supports pagination, multiple targets per run, and configurable sort orders.

- **URL**: https://apify.com/xxoo/cheapest-reddit-scraper-api.md
- **Developed by:** [XXOO](https://apify.com/xxoo) (community)
- **Categories:** AI, SEO tools, Social media
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## 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/platform/actors/running/actors-in-store#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

Scrape Reddit posts, comments, search results, and user profiles via the public JSON API. No authentication or API key required — all data is read from publicly accessible Reddit endpoints.

### Features

- **Subreddit Posts**: Fetch posts from any subreddit with sort control (hot/new/top/rising) and pagination
- **Post Detail**: Fetch full metadata for one or more posts by URL or short ID
- **Post Comments**: Fetch all comments for a post, flattened from Reddit's nested reply tree
- **Search**: Search all of Reddit (or within a subreddit) with multiple sort options
- **User Profile**: Fetch public profile data for any Reddit user
- **Pagination**: All listing endpoints paginate automatically using Reddit's `after` cursor token
- **Run Stats**: Records per-type success/failure counts and totals in the key-value store

### Input

| Field        | Type    | Required | Default       | Description                                                   |
| ------------ | ------- | -------- | ------------- | ------------------------------------------------------------- |
| `scrapeType` | string  | Yes      | `"subreddit"` | `subreddit` / `post` / `comments` / `search` / `user`         |
| `maxPages`   | integer | No       | `3`           | Global fallback for max pages when no type-specific limit set |

#### Subreddit Posts

| Field               | Type    | Required | Default | Description                                                |
| ------------------- | ------- | -------- | ------- | ---------------------------------------------------------- |
| `subreddits`        | array   | Yes      | —       | Subreddit names or URLs, e.g. `["programming", "python"]`  |
| `sort`              | string  | No       | `"hot"` | Sort order: `hot`, `new`, `top`, `rising`                  |
| `maxSubredditPages` | integer | No       | `3`     | Max pages per subreddit. Each page returns up to 100 posts |

#### Post Detail

| Field      | Type  | Required | Description                               |
| ---------- | ----- | -------- | ----------------------------------------- |
| `postUrls` | array | Yes      | Post URLs or short IDs, e.g. `["abc123"]` |

#### Post Comments

| Field             | Type  | Required | Description            |
| ----------------- | ----- | -------- | ---------------------- |
| `commentPostUrls` | array | Yes      | Post URLs or short IDs |

#### Search

| Field             | Type    | Required | Default       | Description                                            |
| ----------------- | ------- | -------- | ------------- | ------------------------------------------------------ |
| `searchQueries`   | array   | Yes      | —             | Search terms, e.g. `["machine learning"]`              |
| `searchSort`      | string  | No       | `"relevance"` | Sort: `relevance`, `new`, `top`, `comments`            |
| `searchSubreddit` | string  | No       | —             | Restrict search to a specific subreddit                |
| `maxSearchPages`  | integer | No       | `3`           | Max pages per query. Each page returns up to 100 posts |

#### User Profile

| Field       | Type  | Required | Description                       |
| ----------- | ----- | -------- | --------------------------------- |
| `usernames` | array | Yes      | Reddit usernames, e.g. `["spez"]` |

### Output

#### Subreddit Posts & Search Dataset

One row per post, ordered by fetch sequence.

```json
{
  "subreddit": "programming",
  "subredditId": "t5_2fwo",
  "postId": "abc123",
  "title": "Show HN: I built a thing",
  "author": "username",
  "score": 1234,
  "upvoteRatio": 0.97,
  "numComments": 89,
  "url": "https://example.com",
  "selftext": "",
  "isSelf": false,
  "isVideo": false,
  "isStickied": false,
  "thumbnail": "https://...",
  "createdAt": "2024-06-01T12:00:00.000Z",
  "permalink": "https://www.reddit.com/r/programming/comments/abc123/...",
  "flair": "Discussion",
  "domain": "example.com",
  "scrapedAt": "2024-06-01T00:00:00.000Z"
}
```

Search results also include:

| Field         | Description                       |
| ------------- | --------------------------------- |
| `searchQuery` | The query that returned this post |

#### Post Comments Dataset

One row per comment, flattened from Reddit's nested reply tree.

```json
{
  "postId": "abc123",
  "postTitle": "Show HN: I built a thing",
  "postUrl": "https://www.reddit.com/r/programming/comments/abc123/...",
  "commentId": "def456",
  "parentId": "t3_abc123",
  "author": "commenter",
  "body": "Great work!",
  "score": 42,
  "depth": 0,
  "createdAt": "2024-06-01T12:05:00.000Z",
  "permalink": "https://www.reddit.com/r/programming/comments/abc123/_/def456/",
  "isStickied": false,
  "scrapedAt": "2024-06-01T00:00:00.000Z"
}
```

`parentId` is in Reddit's fullname format: `t3_xxx` for top-level comments (direct post replies), `t1_xxx` for replies to other comments.

#### User Profile Dataset

One row per user.

```json
{
  "username": "spez",
  "userId": "4x9y7",
  "linkKarma": 125000,
  "commentKarma": 98000,
  "totalKarma": 223000,
  "createdAt": "2005-06-06T00:00:00.000Z",
  "isGold": false,
  "isMod": false,
  "iconImg": "https://...",
  "verified": true,
  "scrapedAt": "2024-06-01T00:00:00.000Z"
}
```

#### Stats (Key-Value Store)

Stored under key `stats` after each run.

**Subreddit Posts:**

```json
{ "total": 2, "succeededSubreddits": 2, "failedSubreddits": 0, "totalPosts": 587 }
```

**Post Comments:**

```json
{ "total": 1, "succeededPosts": 1, "failedPosts": 0, "totalComments": 312 }
```

**Search:**

```json
{ "total": 3, "succeededQueries": 3, "failedQueries": 0, "totalPosts": 900 }
```

**User Profile:**

```json
{ "total": 2, "succeededUsers": 2, "failedUsers": 0, "totalUsers": 2 }
```

### Usage Examples

#### Scrape hot posts from multiple subreddits

```json
{
  "scrapeType": "subreddit",
  "subreddits": ["programming", "python", "javascript"],
  "sort": "hot",
  "maxSubredditPages": 2
}
```

#### Fetch all comments for a specific post

```json
{
  "scrapeType": "comments",
  "commentPostUrls": ["https://www.reddit.com/r/programming/comments/abc123/title/"]
}
```

#### Search Reddit for a topic

```json
{
  "scrapeType": "search",
  "searchQueries": ["machine learning", "large language models"],
  "searchSort": "top",
  "maxSearchPages": 5
}
```

#### Search within a specific subreddit

```json
{
  "scrapeType": "search",
  "searchQueries": ["beginner projects"],
  "searchSubreddit": "learnprogramming",
  "maxSearchPages": 2
}
```

#### Fetch user profiles

```json
{
  "scrapeType": "user",
  "usernames": ["spez", "kn0thing"]
}
```

#### Fetch a post by short ID

```json
{
  "scrapeType": "post",
  "postUrls": ["abc123", "def456"]
}
```

### Pricing

This actor charges one result event per dataset row successfully saved — one per post, comment, or user profile. Non-result events are not billed.

Skipped inputs, unavailable items, and processing errors are reported in the logs rather than saved as dataset rows.

### Limitations

- Only collects publicly accessible Reddit data. Private, deleted, removed, login-gated, or moderator-only content is not accessible.
- Reddit may return different fields for different post types, subreddits, or users. Missing fields default to `null` or `0`.
- Media links are source-hosted URLs. This actor does not download or mirror any Reddit media files to Apify storage.
- Some subreddits, users, or posts may be unavailable at run time. The actor skips those items and continues processing the rest.

### FAQ

**Does this actor require a Reddit account or API key?**
No API key or OAuth credentials are required. The actor reads from Reddit's public JSON endpoints.

**Can I scrape comments under posts?**
Yes — use `scrapeType: "comments"` with one or more post URLs or IDs to fetch all comments, flattened from Reddit's nested reply tree.

**Are skipped or failed items saved as rows?**
No. The dataset only contains successfully scraped results. Skipped, duplicate, and unavailable items are summarised in the logs and in the `stats` key-value store entry.

**Can I use this actor with the Apify API?**
Yes. Run it via the Apify Console or API, then export the dataset as JSON, CSV, Excel, XML, RSS, or HTML. You can also schedule runs and connect output to webhooks or integrations.

# Actor input Schema

## `scrapeType` (type: `string`):

Select what type of data to scrape from Reddit.

## `maxPages` (type: `integer`):

Global fallback for max pages across all paginated types (Subreddit Posts, Search) when no type-specific limit is set. Each page returns up to 100 posts.

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

Subreddit names or URLs to scrape posts from, e.g. "programming" or "https://www.reddit.com/r/programming/". Required for Scrape Type: Subreddit Posts.

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

Sort order for subreddit posts.

## `maxSubredditPages` (type: `integer`):

Maximum number of pages to scrape per subreddit. Each page returns up to 100 posts. Falls back to "Max Pages (Global Default)" if not set.

## `postUrls` (type: `array`):

Reddit post URLs (e.g. "https://www.reddit.com/r/programming/comments/abc123/title/") or short IDs (e.g. "abc123"). Required for Scrape Type: Post Detail.

## `commentPostUrls` (type: `array`):

Reddit post URLs or short IDs to fetch comments for. Required for Scrape Type: Post Comments.

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

Search keywords to query Reddit for, e.g. "machine learning" or "rust programming". Required for Scrape Type: Search.

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

Sort order for search results.

## `searchSubreddit` (type: `string`):

Optional. Restrict search results to a specific subreddit (e.g. "programming"). Leave blank to search all of Reddit.

## `maxSearchPages` (type: `integer`):

Maximum number of result pages to scrape per query. Each page returns up to 100 posts. Falls back to "Max Pages (Global Default)" if not set.

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

Reddit usernames to fetch public profiles for, e.g. "spez". Required for Scrape Type: User Profile.

## Actor input object example

```json
{
  "scrapeType": "subreddit",
  "maxPages": 3,
  "subreddits": [
    "programming"
  ],
  "sort": "hot",
  "maxSubredditPages": 3,
  "searchQueries": [
    "machine learning"
  ],
  "searchSort": "relevance",
  "maxSearchPages": 3,
  "usernames": [
    "spez"
  ]
}
```

# Actor output Schema

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

URL of the dataset with the results

## `crawlStats` (type: `string`):

Statistics about the crawl process

# 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": [
        "programming"
    ],
    "searchQueries": [
        "machine learning"
    ],
    "usernames": [
        "spez"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xxoo/cheapest-reddit-scraper-api").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": ["programming"],
    "searchQueries": ["machine learning"],
    "usernames": ["spez"],
}

# Run the Actor and wait for it to finish
run = client.actor("xxoo/cheapest-reddit-scraper-api").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": [
    "programming"
  ],
  "searchQueries": [
    "machine learning"
  ],
  "usernames": [
    "spez"
  ]
}' |
apify call xxoo/cheapest-reddit-scraper-api --silent --output-dataset

```

## MCP server setup

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

```

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/dQocJwEncXdP4cQW1/builds/zMVzUfRp7rp5Vp4va/openapi.json
