# Reddit Posts & Comments Scraper (`w3crawler/reddit-posts-scraper`) Actor

Scrape publicly rendered Reddit subreddit posts and optional comments with bounded browser extraction and fail-closed diagnostics.

- **URL**: https://apify.com/w3crawler/reddit-posts-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 57.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 subreddit posts

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

Collect **bounded public posts from Reddit subreddit listings**, with optional comments from each saved post. Choose one or more subreddits, a listing sort, and a top/controversial time window; the Actor renders each listing, follows bounded scroll batches, saves post identity, score, ratio, comment count, flair, media markers, timestamps, and listing provenance, and can open each post for up to 100 public comments. No login, private API, or access-control bypass is used.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/reddit-posts-scraper) and select **Try for free**, or open the **Input** tab.
2. Add one to 20 subreddit names to `subreddits`, then choose `sort`; use `topTime` when sorting by `top` or `controversial`.
3. Set `maxPostsPerSubreddit` and `maxPages` to keep the first run small. Leave `includeComments` on if you also want post-page comments.
4. Start the Actor, open the dataset, and export the rows as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT_SUMMARY`) to see stored posts, failed requests, and pagination stats.

### Input

`subreddits` is required. Every other field is optional and uses the default shown below. Unsupported field names and out-of-range values are rejected before the browser starts.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `subreddits` | string array | Required | `["technology"]` | One to 20 unique subreddit names, with or without `r/`, each 2–100 characters. |
| `sort` | string enum | Optional | `hot` | Listing order: `hot`, `new`, `top`, `rising`, or `controversial`. |
| `topTime` | string enum | Optional | `week` | Time window for `top` and `controversial`: `hour`, `day`, `week`, `month`, `year`, or `all`. |
| `maxPostsPerSubreddit` | integer | Optional | `25` | Maximum post rows saved from each subreddit listing, 1–100. |
| `maxPages` | integer | Optional | `3` | Maximum rendered listing snapshots or scroll batches per subreddit, 1–10. The URL and sort/time parameters stay unchanged while cards append. |
| `scrollDelayMs` | integer | Optional | `500` | Wait after each public scroll so post cards load, 0–3,000 ms. Use `0` only for tests. |
| `includeComments` | boolean | Optional | `true` | Visit each saved post and attach bounded public comments when available. |
| `maxCommentsPerPost` | integer | Optional | `20` | Maximum public comments attached to each saved post, 1–100. |
| `proxyConfiguration` | object | Optional | `{"useApifyProxy":true}` | Apify Proxy or custom proxy settings; Apify Proxy is enabled by default. |

Full default input:

```json
{
  "subreddits": [
    "technology"
  ],
  "sort": "hot",
  "topTime": "week",
  "maxPostsPerSubreddit": 25,
  "maxPages": 3,
  "scrollDelayMs": 500,
  "includeComments": true,
  "maxCommentsPerPost": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

The Actor builds one listing URL per subreddit, such as `https://www.reddit.com/r/technology/hot/`, reads rendered `shreddit-post` cards, and never logs in or calls a private endpoint.

### Output

The dataset contains one row per saved listing post. Fields the public listing or optional post page does not expose are omitted rather than inferred. Blocked, empty, or failed listings are counted in `OUTPUT_SUMMARY` and logs, never written as diagnostic rows.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `recordType` | string enum | Always | Row discriminator; always `post`. |
| `recordId` | string | Always | Stable identity derived from the Reddit post ID. |
| `sourceUrl` | string | Always | Public post permalink used as provenance. |
| `position` | integer | Always | One-based position within the subreddit listing. |
| `pageNumber` | integer | Always | One-based rendered listing snapshot that first exposed the row. |
| `sourceCursor` | string | When exposed | Continuation cursor exposed by the rendered listing; omitted otherwise. |
| `postId` | string | Always | Bare Reddit base36 post ID without the `t3_` prefix. |
| `postFullname` | string | Always | Post fullname in `t3_<postId>` form. |
| `postTitle` | string | Always | Public post title. |
| `contentUrl` | string | Always | Public content destination URL. |
| `permalink` | string | Always | Public Reddit permalink. |
| `subreddit` | string | Always | Public subreddit name. |
| `subredditId` | string | When published | Public subreddit identifier. |
| `subredditPrefixed` | string | When published | Public `r/name` form. |
| `author` | string | When published | Public author name. |
| `authorFullname` | string | When published | Public author identifier. |
| `score` | number | When published | Public post score at collection time. |
| `upvoteRatio` | number | When published | Public upvote ratio. |
| `numComments` | number | When published | Public comment count at collection time. |
| `selfText` | string | When available | Visible public self-text; often absent for link posts. |
| `postFlair` | string | When published | Public post flair. |
| `domain` | string | When published | Public post domain. |
| `postType` | string | When published | Public post type, such as `link` or `self`. |
| `isVideo` | boolean | When published | Public video marker. |
| `isSelf` | boolean | When published | Public self-post marker. |
| `isOriginalContent` | boolean | When published | Public original-content marker. |
| `isSpoiler` | boolean | When published | Public spoiler marker. |
| `over18` | boolean | When published | Public 18+ marker. |
| `totalAwards` | number | When published | Public award count. |
| `createdAt` | string | When published | Public creation time normalized to ISO UTC. |
| `createdUtc` | integer | When published | Public creation time as Unix seconds. |
| `comments` | object array | When `includeComments` is enabled and post-page comments are available | Up to `maxCommentsPerPost` public comments. |
| `sortedBy` | string | Always | Listing sort used. |
| `topTime` | string | Always | Top/controversial time filter used. |
| `sourceListingUrl` | string | Always | Public subreddit listing URL. |
| `extractionMethod` | string | Always | Public DOM extraction method, currently `reddit-shreddit-post-listing`. |
| `scrapedAt` | string | Always | UTC extraction time. |

Each `comments` entry contains `id`, `author`, `body` (up to 2,000 characters), `score`, `createdAt`, and `depth` when the public post page exposes them.

Each `comments` entry contains `id`, `author`, `body` (up to 2,000 characters), `score`, `createdAt`, and `depth` when the public post page exposes them.

#### Full JSON output

This is a real saved row from the 2026-10-25 run. It is complete; `selfText` and `comments` were absent because the listing did not expose a body and the row contains no comments array.

```json
{
  "recordType": "post",
  "recordId": "reddit-post:f29ddf097562244fe310",
  "sourceUrl": "https://www.reddit.com/r/technology/comments/1xf03qh/cybersecurity_bounty_hunter_says_samsung_tvs_use/",
  "position": 1,
  "pageNumber": 1,
  "sourceCursor": "dDNfMXhmOXNzbA",
  "postId": "1xf03qh",
  "postFullname": "t3_1xf03qh",
  "postTitle": "Cybersecurity bounty hunter says Samsung TVs use AI to record audio and screenshots for ads — 'Finally found a company that truly listens to its customers,' says hacker",
  "contentUrl": "https://www.tomshardware.com/tech-industry/cyber-security/hacker-finds-own-samsung-tv-collecting-scary-amounts-of-user-information-and-gets-banned-by-openai-for-cyber-abuse-tv-runs-an-ai-model-that-collects-audio-screenshots-and-plenty-of-other-user-data-for-ad-targeting",
  "permalink": "https://www.reddit.com/r/technology/comments/1xf03qh/cybersecurity_bounty_hunter_says_samsung_tvs_use/",
  "subreddit": "technology",
  "subredditId": "t5_2qh16",
  "subredditPrefixed": "r/technology",
  "author": "ArgentineBeauty",
  "authorFullname": "t2_2dz0v026uy",
  "score": 15186,
  "upvoteRatio": 0.9804216867469879,
  "numComments": 886,
  "postFlair": "Privacy",
  "domain": "tomshardware.com",
  "postType": "link",
  "isVideo": false,
  "isSelf": false,
  "isOriginalContent": false,
  "isSpoiler": false,
  "over18": false,
  "totalAwards": 0,
  "createdAt": "2026-10-25T11:35:48.559Z",
  "createdUtc": 1792928148,
  "sortedBy": "hot",
  "topTime": "week",
  "sourceListingUrl": "https://www.reddit.com/r/technology/hot/",
  "extractionMethod": "reddit-shreddit-post-listing",
  "scrapedAt": "2026-10-25T20:49:50.649Z"
}
```

### Run summary

**Run summary** is stored separately from the dataset in the run's key-value store under `OUTPUT_SUMMARY`. It records scope, counts, and pagination behavior; failure details remain in the actor log.

| Field | Meaning |
| --- | --- |
| `recordType` | Summary discriminator; `runSummary`. |
| `status` | Actor outcome: `SUCCEEDED` or `FAILED`. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `outputWriteFailureCount` | Failed summary-write attempts, normally `0`. |
| `source` | Public Reddit source. |
| `subreddits` | Validated subreddit names requested. |
| `sort` | Listing sort used. |
| `topTime` | Time window applied to top or controversial listings. |
| `maxPostsPerSubreddit` | Configured post cap per subreddit. |
| `maxPages` | Configured snapshot cap per subreddit. |
| `scrollDelayMs` | Configured wait after each scroll. |
| `requestedPages` | Configured page cap; equals `maxPages`. |
| `requestedItemsPerSource` | Configured item cap per source; equals `maxPostsPerSubreddit`. |
| `includeComments` | Whether post-page comment extraction was requested. |
| `maxCommentsPerPost` | Configured comment cap per post. |
| `proxyConfigured` | Whether a proxy configuration was created. |
| `recordsStored` | Post rows written to the dataset. |
| `failedRequests` | Subreddit requests that failed or returned unusable data. |
| `normalCount` | Normal post rows written; equals `recordsStored`. |
| `diagnosticCount` | Number of diagnostic outcomes; details remain in logs and no diagnostic rows are saved. |
| `pagesProcessed` | Total rendered listing snapshots processed. |
| `scrollRounds` | Total scroll continuation attempts. |
| `candidateCount` | Rendered candidate rows observed before deduplication. |
| `uniqueCount` | Unique candidates accepted by the paginator before normalization. |
| `duplicatesSkipped` | Duplicate post IDs skipped across snapshots and subreddits. |
| `noProgressStops` | Listings stopped after repeated snapshots with no new post IDs. |
| `sourceExhaustedCount` | Listings that ended because the page could not advance or made no progress. |
| `paginationMode` | Pagination strategy; currently `bounded_scroll`. |
| `found` | Whether at least one post was stored. |
| `dataAvailable` | Whether usable public post data was saved. |
| `scrapedAt` | Time the summary was written, in ISO UTC. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | At least one post was saved and no listing request failed. |
| `SUCCEEDED` | `PARTIAL` | At least one post was saved, but a listing failed or the crawl stopped early. Saved rows remain available. |
| `SUCCEEDED` | `NO_RESULTS` | Listings completed without failure but no post was stored. |
| `FAILED` | `FAILED` | No post was saved and at least one listing request or crawl failure occurred. |

Example `OUTPUT_SUMMARY` from the saved run:

```json
{
  "recordType": "runSummary",
  "status": "SUCCEEDED",
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "outputWriteFailureCount": 0,
  "source": "https://www.reddit.com",
  "subreddits": [
    "technology"
  ],
  "sort": "hot",
  "topTime": "week",
  "maxPostsPerSubreddit": 3,
  "maxPages": 2,
  "scrollDelayMs": 500,
  "requestedPages": 2,
  "requestedItemsPerSource": 3,
  "includeComments": true,
  "maxCommentsPerPost": 20,
  "proxyConfigured": true,
  "recordsStored": 3,
  "failedRequests": 0,
  "diagnosticCount": 0,
  "pagesProcessed": 1,
  "scrollRounds": 0,
  "candidateCount": 3,
  "uniqueCount": 3,
  "normalCount": 3,
  "duplicatesSkipped": 0,
  "noProgressStops": 0,
  "sourceExhaustedCount": 0,
  "paginationMode": "bounded_scroll",
  "found": true,
  "dataAvailable": true,
  "scrapedAt": "2026-10-25T20:50:19.054Z"
}
```

### Coverage and limitations

The Actor reads only the public rendered listing for each requested subreddit and sort. Reddit controls ranking and content, so a run is a snapshot of that listing, not a complete subreddit archive. `maxPages` limits rendered snapshots or scroll batches, not result pages; a listing stops early when it makes no progress, exposes no cursor, or reaches the post cap. `maxPostsPerSubreddit` applies to each subreddit, and duplicate post IDs are skipped within and across sources for the run.

`includeComments` opens each saved post in the browser. If detail data is unavailable, the Actor keeps the listing fields and omits `comments`; the saved run contains no comments array despite `includeComments: true`, so treat comments as best-effort per row. Comments are read from rendered `shreddit-comment` elements and capped by `maxCommentsPerPost`; comment scores default to `0` when the attribute is absent, bodies are truncated at 2,000 characters, and deleted or removed comment text is whatever Reddit displayed. `selfText` appears only when the post page exposes a body; link posts often have none. Score, ratio, comment count, awards, and flair are point-in-time values.

Challenges, login walls, rate limits, and blocked requests fail closed for that request and are counted in `OUTPUT_SUMMARY` and logs; no diagnostic or placeholder rows enter the dataset. Private, quarantined, deleted, or login-gated posts cannot be read. Optional proxy settings are supported when supplied.

### Usage and support

Cost is driven by headless-browser time, one listing page per subreddit, optional post-page visits for comments, and proxy traffic. Start with one subreddit, `maxPostsPerSubreddit` of 3–10, and `includeComments` off if you only need listing data. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/reddit-posts-scraper/issues) to report a problem. Include the run ID, the input used, and the `OUTPUT_SUMMARY` record; do not include tokens, cookies, or private data. This Actor is not affiliated with Reddit. Use it only for public data and in accordance with Reddit's terms, robots guidance, and applicable law. Public pages can contain personal information; use the output only for lawful purposes.

# Changelog

This Actor's version history is a separate document: https://apify.com/w3crawler/reddit-posts-scraper/changelog.md

# Actor input Schema

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

One to 20 subreddit names, optionally prefixed with r/.

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

Public Reddit listing order.

## `topTime` (type: `string`):

Time filter used by top and controversial listings.

## `maxPostsPerSubreddit` (type: `integer`):

Maximum public post records saved from each listing.

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

Maximum rendered listing snapshots/scroll batches processed for each subreddit. The listing URL and sort/time query parameters remain unchanged while Reddit appends public post cards.

## `scrollDelayMs` (type: `integer`):

Bounded wait after each public DOM scroll so Reddit can append post cards. Use 0 only for deterministic tests; the default is 500 ms.

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

Visit saved posts and include bounded public comments when available.

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

Maximum public comments included for each saved post.

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

Optional Apify Proxy or custom proxy settings.

## Actor input object example

```json
{
  "subreddits": [
    "technology"
  ],
  "sort": "hot",
  "topTime": "week",
  "maxPostsPerSubreddit": 25,
  "maxPages": 3,
  "scrollDelayMs": 500,
  "includeComments": true,
  "maxCommentsPerPost": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Source-backed result records from the default dataset.

## `runSummary` (type: `string`):

Subreddit scope, sort/time/comment settings, saved posts, failures, and diagnostics.

# 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("w3crawler/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("w3crawler/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 w3crawler/reddit-posts-scraper --silent --output-dataset

```

## MCP server setup

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