# Reddit Post & Comment Scraper (`miccho27/reddit-post-scraper`) Actor

Scrape Reddit posts and comments from any subreddit or thread URL. Extract titles, scores, authors, comment trees, and metadata. No Reddit API key or OAuth required.

- **URL**: https://apify.com/miccho27/reddit-post-scraper.md
- **Developed by:** [Tatsuya Mizuno](https://apify.com/miccho27) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 15 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Reddit Post & Comment Scraper - Free Subreddit Data Extractor (Alternative to Reddit API, Pushshift, Arctic Shift)

Scrape Reddit posts and comments from any subreddit or thread URL -- titles, scores, authors, awards, flairs, and full comment trees. No Reddit API key, no OAuth, no developer application. The best free alternative to Reddit Data API ($0.24/1K calls), Pushshift (discontinued), Arctic Shift, and SocialGrep.

### Who Is This For?

- **Content marketers** -- Find trending topics, popular questions, and content gaps in your niche subreddits
- **Market researchers** -- Analyze sentiment, feature requests, and pain points from product-related subreddits
- **SEO specialists** -- Discover high-engagement keywords and questions people are asking on Reddit
- **Data scientists** -- Build NLP datasets from Reddit comments for sentiment analysis and topic modeling
- **Product managers** -- Monitor user feedback, feature requests, and bug reports on product subreddits
- **Competitive intelligence** -- Track competitor mentions, comparisons, and user sentiment across subreddits

### Pricing -- Free to Start

| Tier | Cost | What You Get |
|------|------|-------------|
| **Free trial** | $0 | Apify free tier includes monthly compute credits |
| **Pay per result** | ~$2.00 / 1,000 posts | Subreddit scraping with comments |
| **vs. Reddit API** | Saves $0.24/1K calls | No OAuth, no application, no rate limits |
| **vs. Pushshift** | Still works | Pushshift was discontinued in 2023 |

### Quick Start (3 Steps)

1. **Click "Try for free"** on this Actor's page in Apify Store
2. **Enter subreddits** (e.g., `["webdev", "javascript"]`) or paste post URLs
3. **Click "Start"** and get Reddit data as JSON, CSV, or Excel

### Features

- **Subreddit scraping**: Extract posts from any public subreddit (hot, new, top, rising)
- **Post detail scraping**: Scrape individual posts with full comment trees
- **Rich metadata**: Title, score, upvote ratio, author, flair, awards, NSFW flag, pinned status
- **Comment extraction**: Top-level comments with author, score, and OP indicator
- **Time filters**: Filter top posts by hour, day, week, month, year, or all time
- **No API key**: Uses Reddit's public JSON endpoints
- **Retry & rate limiting**: Automatic retries with configurable delays

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `subreddits` | array | Subreddit names without `r/` (e.g. `["webdev", "javascript"]`) | -- |
| `postUrls` | array | Direct Reddit post URLs to scrape with comments | -- |
| `sortBy` | string | `"hot"`, `"new"`, `"top"`, `"rising"` | `"hot"` |
| `timeFilter` | string | Time range for top sort: `"hour"`, `"day"`, `"week"`, `"month"`, `"year"`, `"all"` | `"week"` |
| `maxPostsPerSubreddit` | integer | Max posts per subreddit (1-100) | `25` |
| `includeComments` | boolean | Extract top-level comments for each post | `false` |
| `maxCommentsPerPost` | integer | Max comments per post (1-50) | `10` |
| `delayBetweenRequestsMs` | integer | Delay between requests in ms (min 1000) | `2000` |

#### Example Input -- Subreddit Scraping

```json
{
  "subreddits": ["webdev", "javascript", "reactjs"],
  "sortBy": "top",
  "timeFilter": "week",
  "maxPostsPerSubreddit": 25,
  "includeComments": false
}
```

#### Example Input -- Post with Comments

```json
{
  "postUrls": [
    "https://www.reddit.com/r/webdev/comments/abc123/best_frameworks_2024/"
  ],
  "includeComments": true,
  "maxCommentsPerPost": 20
}
```

#### Example Input -- Market Research

```json
{
  "subreddits": ["SaaS", "startups", "entrepreneur"],
  "sortBy": "top",
  "timeFilter": "month",
  "maxPostsPerSubreddit": 50,
  "includeComments": true,
  "maxCommentsPerPost": 5
}
```

### Output

```json
{
  "id": "1abc2de",
  "title": "What's the best JS framework in 2024?",
  "author": "webdev_user",
  "subreddit": "webdev",
  "score": 1247,
  "upvoteRatio": 0.94,
  "numComments": 384,
  "url": "https://www.reddit.com/r/webdev/comments/1abc2de/...",
  "permalink": "https://www.reddit.com/r/webdev/comments/1abc2de/...",
  "selfText": "I've been comparing React, Vue, and Svelte...",
  "flair": "Discussion",
  "awards": 5,
  "createdUtc": "2024-01-15T08:30:00.000Z",
  "isNsfw": false,
  "isPinned": false,
  "comments": [
    {
      "id": "k5f6g7h",
      "author": "senior_dev",
      "body": "React is still the safe bet for most teams...",
      "score": 523,
      "createdUtc": "2024-01-15T09:15:00.000Z",
      "isOp": false,
      "awards": 2
    }
  ],
  "scrapedAt": "2024-01-15T10:30:00.000Z"
}
```

### Real-World Use Cases

#### 1. Content Research for Blog Posts

Scrape top posts from niche subreddits to find the most discussed topics. Use titles and comments as inspiration for blog articles and YouTube videos.

#### 2. Product Feedback Mining

Monitor your product's subreddit for feature requests, bug reports, and user sentiment. Schedule weekly runs and export to Google Sheets for product team review.

#### 3. SEO Keyword Discovery

Extract post titles from relevant subreddits. Analyze the language users actually use when asking questions -- these become long-tail keyword opportunities.

#### 4. Competitive Intelligence

Track competitor mentions across industry subreddits. Compare sentiment and feature discussions to inform your product roadmap.

#### 5. Academic NLP Dataset

Build labeled datasets from subreddit comments for sentiment analysis, topic classification, and language model fine-tuning.

### FAQ

**Q: Can I scrape private subreddits?**
A: No. Only public subreddits are accessible.

**Q: What about Reddit's API pricing?**
A: This Actor uses Reddit's public JSON endpoints, not the official API. No API key or payment required.

**Q: How many posts can I scrape per run?**
A: Up to 100 per subreddit, multiple subreddits per run. For large-scale scraping, use multiple runs.

**Q: Will Reddit block me?**
A: The Actor includes rate limiting. Use Apify's proxy pool for consistent access with large batches.

### Notes & Limitations

- **Public subreddits only**: Private and quarantined subreddits are not accessible.
- **JSON endpoints**: Uses Reddit's `.json` endpoint (old.reddit.com). No OAuth required.
- **Rate limiting**: 2s+ delay between requests. Reddit may throttle aggressive scraping.
- **Comment depth**: Extracts top-level comments only. Nested reply trees are not included.
- **NSFW content**: Posts flagged as NSFW include the `isNsfw: true` field.
- **For research purposes**: Use in compliance with Reddit's Terms of Service.

# Actor input Schema

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

Array of subreddit names to scrape (e.g., \["programming", "technology"]). Prefix 'r/' is optional.

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

Array of full Reddit post URLs to scrape. Alternative to subreddits.

## `sortBy` (type: `string`):

How to sort subreddit posts: 'hot', 'new', 'top'. Default: 'hot'

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

Time filter for 'top' sorting: 'hour', 'day', 'week', 'month', 'year', 'all'. Default: 'week'

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

Maximum number of posts to scrape per subreddit (1-100). Default: 25

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

Whether to include post comments in the output. Default: false

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

Maximum number of comments to extract per post (1-50). Default: 10

## `delayBetweenRequestsMs` (type: `integer`):

Milliseconds to delay between requests. Default: 2000

## Actor input object example

```json
{
  "subreddits": [
    "AskReddit"
  ],
  "postUrls": [],
  "sortBy": "hot",
  "timeFilter": "week",
  "maxPostsPerSubreddit": 25,
  "includeComments": false,
  "maxCommentsPerPost": 10,
  "delayBetweenRequestsMs": 2000
}
```

# 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": [
        "AskReddit"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("miccho27/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 = { "subreddits": ["AskReddit"] }

# Run the Actor and wait for it to finish
run = client.actor("miccho27/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 '{
  "subreddits": [
    "AskReddit"
  ]
}' |
apify call miccho27/reddit-post-scraper --silent --output-dataset

```

## MCP server setup

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