# Reddit Scraper - Subreddit Posts & Comments (`sweet_stickball/reddit-scraper`) Actor

Scrape Reddit posts from any subreddit (hot, new, top, rising) or the comments of a post: title, author (pseudonymized), date, link, permalink and text. Reddit scraper using public feeds, with optional official API credentials for scores.

- **URL**: https://apify.com/sweet_stickball/reddit-scraper.md
- **Developed by:** [CrawlKit](https://apify.com/sweet_stickball) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.70 / 1,000 post or comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

Scrapes public Reddit posts and comments from any subreddit or post URL. Returns titles, authors (pseudonymized), dates, links and post or comment text. No login is required. If you supply your own Reddit app credentials, the Actor uses the official Reddit API and also returns scores, comment counts, flair and comment nesting.

### What it does

- **Subreddit mode**: fetches posts from a subreddit sorted by hot, new, top or rising, and paginates automatically to reach the requested number of items.
- **Post comments mode**: when given a post URL (containing `/comments/`), returns the post's comments (up to 500).
- **Data sources**:
  - Without credentials, the Actor reads Reddit's public Atom feeds (`/r/<subreddit>/<sort>/.rss`, `/comments/<id>/.rss`). Reddit's anonymous `.json` endpoints now refuse requests from cloud and proxy IPs, so they are not used.
  - With `clientId` and `clientSecret`, it requests an application-only OAuth token and reads `oauth.reddit.com`. If the credentials are rejected, it falls back to the public feeds.
- Authors are pseudonymized (first 3 characters + `***`).

### Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `subreddit` | string | Yes | - | Subreddit name (`python`), prefixed (`r/python`, `/r/python`), or full URL. Can also be a post URL to scrape comments. |
| `maxItems` | integer | No | 20 | Maximum number of posts or comments to return (1-10000). |
| `sort` | enum | No | `hot` | Sort order: `hot`, `new`, `top`, `rising`. |
| `topPeriod` | enum | No | `all` | Time filter when sort is `top`: `hour`, `day`, `week`, `month`, `year`, `all`. |
| `clientId` | string (secret) | No | - | Client ID of your own Reddit app (create one at https://www.reddit.com/prefs/apps). Enables the official API. |
| `clientSecret` | string (secret) | No | - | Secret of the same Reddit app. Never logged or written to the dataset. |

### Output

Each dataset item is a flat JSON object. Posts and comments have different fields. `dataSource` tells you which source produced the item (`rss` or `api`).

**Post example (public feed):**

```json
{
    "id": "1xb7op7",
    "title": "Anthropic logged net loss of over $80 billion in first half of 2026",
    "author": "Car***",
    "score": null,
    "numComments": null,
    "createdUtc": "2026-10-20T23:36:46+00:00",
    "text": null,
    "subreddit": "technology",
    "url": "https://www.reuters.com/business/anthropic-recorded-net-loss-over-80-billion-first-half-this-year-wsj-reports-2026-10-20/",
    "permalink": "https://www.reddit.com/r/technology/comments/1xb7op7/anthropic_logged_net_loss_of_over_80_billion_in/",
    "flair": null,
    "awards": null,
    "mediaUrl": null,
    "thumbnail": null,
    "isNsfw": null,
    "type": "post",
    "dataSource": "rss",
    "query": "technology",
    "scrapedAt": "2026-10-21T10:01:55+00:00"
}
```

With the official API (`dataSource: "api"`), `score`, `numComments`, `flair`, `awards`, `mediaUrl` and `isNsfw` are filled.

**Comment example (public feed):**

```json
{
    "id": "phyihgq",
    "body": "I mean this is actually insane.",
    "author": "wem***",
    "score": null,
    "createdUtc": "2026-10-20T23:43:08+00:00",
    "depth": null,
    "parentId": null,
    "postId": "t3_1xb7op7",
    "isOp": false,
    "permalink": "https://www.reddit.com/r/technology/comments/1xb7op7/anthropic_logged_net_loss_of_over_80_billion_in/phyihgq/",
    "type": "comment",
    "dataSource": "rss",
    "subreddit": "technology",
    "query": "technology",
    "scrapedAt": "2026-10-21T10:05:12+00:00"
}
```

### Pricing

Pay-per-event, **no start fee**: **$2.80 per 1,000 posts or comments** on the Apify Free plan, with lower prices on paid plans. Each post or comment pushed to the dataset is one event.

| Event | Free | Starter | Scale | Business | Enterprise |
|-------|------|---------|-------|----------|------------|
| Post or comment (`RESULT`) | $2.80 | $2.40 | $2.10 | $1.70 | $1.70 |

Prices in USD per 1,000 events.

#### Cost examples (Free plan)

| Scenario | Items | Cost |
|----------|-------|------|
| Quick check | 25 | $0.07 |
| Daily subreddit monitoring | 100 | $0.28 |
| Thread with comments | 500 | $1.40 |
| Research batch | 5,000 | $14.00 |

### Limitations

- Only public subreddit content is accessible. Private, banned and quarantined subreddits are not supported (the run fails with a "not found" message).
- Public feeds do not include score, comment count, flair, awards, video URL, NSFW flag or comment nesting (`depth`, `parentId`); these fields are `null` unless you provide Reddit app credentials.
- For comments read from the public feed, `createdUtc` is the time of the last edit when a comment was edited.
- Comment mode returns at most 500 comments per post; collapsed "load more" threads are not expanded.
- Deep pagination (`after` cursor) is capped by Reddit at roughly 1,000 posts per listing.
- NSFW content is included when present in the subreddit.
- Reddit may change or restrict its public feeds or API without notice.

### Related Actors

- [Google News Scraper - News Articles by Keyword](https://apify.com/sweet_stickball/google-news-scraper) — Scrape Google News articles for any keyword: headlines, sources, publish dates, URLs and snippets.
- [Telegram Channel Scraper - Public Channel Messages](https://apify.com/sweet_stickball/telegram-public-channel-scraper) — Scrape messages from public Telegram channels: text, dates, views, media and links.
- [YouTube Transcript Scraper - Captions & Comments](https://apify.com/sweet_stickball/youtube-transcripts) — Scrape YouTube video transcripts (captions and auto-generated subtitles) with timestamps, video metadata and optional comments.

# Actor input Schema

## `subreddit` (type: `string`):

Subreddit name (e.g. 'python') or full Reddit URL (e.g. 'https://reddit.com/r/python'). Can also be a post URL to scrape comments.

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

Maximum number of posts or comments to return.

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

How to sort subreddit posts.

## `topPeriod` (type: `string`):

Only used when sort is 'top'. Time period to filter top posts.

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

Optional. Client ID of your own Reddit app (create a 'script' or 'web' app at https://www.reddit.com/prefs/apps). With clientId and clientSecret the Actor uses the official Reddit API, which adds score, comment count, flair, NSFW flag and comment nesting. Without them it reads Reddit's public feeds, where these fields are null.

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

Optional. Secret of the same Reddit app. Used only to request an application-only OAuth token; never logged or stored in the dataset.

## Actor input object example

```json
{
  "subreddit": "python",
  "maxItems": 10,
  "sort": "hot",
  "topPeriod": "all"
}
```

# Actor output Schema

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

Dataset items shown with the 'results' view.

# 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 = {
    "subreddit": "artificial",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("sweet_stickball/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 = {
    "subreddit": "artificial",
    "maxItems": 10,
}

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

```

## MCP server setup

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