# Reddit Post Scraper (`codingfrontend/reddit-post-scraper`) Actor

Scrape specific Reddit post URLs for full post details, body text, images, videos, gallery, awards, metadata, and optional comments with nested replies.

- **URL**: https://apify.com/codingfrontend/reddit-post-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 8 total users, 1 monthly users, 63.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 1,000 results

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?

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

### What does Reddit Post Scraper do?

Reddit Post Scraper extracts structured details from **public Reddit post pages** at [reddit.com](https://www.reddit.com/). It is a practical Reddit data extraction tool for collecting post metadata, public text, media metadata, and optional comments from a list of post URLs. It uses the rendered public page and does not require a Reddit login or a private API session.

The Actor is designed for specific post URLs rather than broad subreddit crawling. If Reddit presents a CAPTCHA, login wall, rate-limit page, WAF response, or another access-denied page, the Actor stops without manufacturing a result. A run with no successfully saved post fails closed, leaves the dataset empty, and writes explicit availability diagnostics to `OUTPUT`.

### Why use Reddit Post Scraper?

- Collect consistent post records for trend research, content analysis, and social listening.
- Preserve the requested URL, source URL, extraction method, proxy state, and scrape timestamp for provenance.
- Optionally collect up to 20 visible top-level comments and up to 5 replies per collected comment.
- Run with Apify scheduling, API access, webhooks, monitoring, and dataset exports.
- Optionally use an explicitly supplied Apify proxy configuration for an authorized network route. No proxy is enabled by default.

### What data can Reddit Post Scraper extract?

| Field | Type | Description |
|-------|------|-------------|
| `postId` | string | Reddit post identifier. |
| `postTitle` | string | Post title. |
| `permalink` | string | Public Reddit permalink. |
| `subreddit` | string | Community name. |
| `author` | string | Public author name, when shown. |
| `score` | number | Post score reported by Reddit. |
| `numComments` | number | Reported comment count. |
| `selfText` | string | Public body text for self posts. |
| `postType` | string | Detected post type such as self, link, image, gallery, or video. |
| `awards` | array | Public award details, when available. |
| `comments` | array | Optional public comments and bounded replies. |
| `scrapedAt` | string | UTC timestamp for the extracted record. |

### How to scrape Reddit posts

1. Open the Input tab and provide one to ten public Reddit post URLs in `postUrls`.
2. Choose whether to collect visible comments with `includeComments`.
3. Keep `headless` enabled for normal Actor runs, or disable it only for an authorized local debugging session.
4. Configure `proxyConfiguration` only when you are permitted to collect the public pages and need a different network route. The Actor never escalates proxy groups or bypasses access controls automatically.
5. Start the Actor and review the dataset in the Output tab. A successful result contains one dataset item per post that passed the completeness checks.

For a bounded direct local verification with comments enabled, run `apify run --purge --input-file INPUT.json` and inspect `storage/datasets/default`.

### How much does it cost?

This Actor uses Apify pay-per-event pricing configured at `$0.003` per post result added to the dataset. Compute, proxy, and subscription charges can also depend on your Apify plan and run configuration. Review the current Pricing tab before production use.

### Input

See the Input tab for the full configuration. The main fields are:

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `postUrls` | array | none | Required list of 1–10 public reddit.com or redd.it post URL strings; duplicates are removed by post ID. |
| `includeComments` | boolean | `true` | Collect visible comments and bounded nested replies. |
| `headless` | boolean | `true` | Run the browser without a visible window. |
| `proxyConfiguration` | object | none | Optional Apify proxy settings. |

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. A simplified item looks like this:

```json
{
  "recordType": "post",
  "position": 1,
  "postId": "t3_example01",
  "postTitle": "Example discussion title",
  "subreddit": "example",
  "author": "exampleuser",
  "score": 128,
  "numComments": 24,
  "permalink": "https://www.reddit.com/r/example/comments/example01/example_discussion/",
  "found": true,
  "dataAvailable": true,
  "scrapedAt": "2025-01-15T13:00:00.000Z"
}
```

### Run summary and storage

Each successful dataset row has `recordType: "post"`. The Actor stores a JSON run summary in the default key-value store under `OUTPUT` with requested URL count, comment/proxy settings, saved records, failed and blocked requests, and data availability. A fail-closed run stores `recordType: "runDiagnostic"` and sanitized request errors there, never in the pay-per-event dataset.

### Tips and troubleshooting

- Keep input lists bounded so a run remains easy to monitor and stays within the target site's limits.
- A zero-result run is intentionally unsuccessful. Check `OUTPUT` and the run log for requested, stored, failed, and blocked counts.
- If Reddit blocks the network request, do not try to bypass a CAPTCHA, login wall, or other access control. Use only public pages and an authorized collection setup.
- Optional fields can be absent when Reddit does not expose them on the public page.

### FAQ, disclaimers, and support

#### Does the Actor scrape private Reddit data?

No. It is intended for public post pages and does not use private endpoints, protected sessions, or login credentials.

#### Can I scrape any Reddit URL?

The input is intended for individual public post URLs. Subreddit listings, user profiles, private communities, and access-denied pages are outside the supported result contract.

Our Actors are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you are unsure whether your reason is legitimate, consult your lawyers.

For programmatic use, see the API tab. For feedback or a reproducible issue, use the Issues tab and include the input shape and relevant run diagnostics without sharing credentials.

# Actor input Schema

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

One to ten unique public reddit.com or redd.it post URLs. URLs are normalized by post ID.

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

Include up to 20 rendered top-level public comments and up to 5 rendered replies per comment.

## `headless` (type: `boolean`):

Run browser in headless mode (recommended for production)

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

Optional Apify proxy settings. No proxy is used unless explicitly configured; access denials are never bypassed.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.reddit.com/r/javascript/comments/1t9jt9w/bluejs_compile_javascript_to_12mb_native_binaries/"
  ],
  "includeComments": true,
  "headless": true
}
```

# Actor output Schema

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

Dataset containing all successfully extracted Reddit post records.

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

Requested post count, comment/browser settings, saved records, failures, and availability.

# 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 = {
    "postUrls": [
        "https://www.reddit.com/r/javascript/comments/1t9jt9w/bluejs_compile_javascript_to_12mb_native_binaries/"
    ],
    "includeComments": true,
    "headless": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("codingfrontend/reddit-post-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 = {
    "postUrls": ["https://www.reddit.com/r/javascript/comments/1t9jt9w/bluejs_compile_javascript_to_12mb_native_binaries/"],
    "includeComments": True,
    "headless": True,
}

# Run the Actor and wait for it to finish
run = client.actor("codingfrontend/reddit-post-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 '{
  "postUrls": [
    "https://www.reddit.com/r/javascript/comments/1t9jt9w/bluejs_compile_javascript_to_12mb_native_binaries/"
  ],
  "includeComments": true,
  "headless": true
}' |
apify call codingfrontend/reddit-post-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codingfrontend/reddit-post-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/ntEcaoUZnWEtgbPBs/builds/83scpcYHd8nSH0off/openapi.json
