# Reddit Posts Scraper (`vulnv/reddit-posts-scraper`) Actor

Unlimited Reddit web scraper to crawl posts, comments and subreddits without login.

- **URL**: https://apify.com/vulnv/reddit-posts-scraper.md
- **Developed by:** [VulnV](https://apify.com/vulnv) (community)
- **Categories:** Automation, Social media, News
- **Features:** Full permissions
- **Stats:** 391 total users, 2 monthly users, 100.0% runs succeeded, 17 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$3.00 / 1,000 posts

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?

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 Scraper: Extract Reddit Data Efficiently

### Overview

The **Reddit Posts Scraper** is a powerful tool designed to extract detailed post data from Reddit. Whether you're conducting sentiment analysis, monitoring trends, or gathering insights for research, this scraper enables efficient and accurate data collection from any subreddit.

### Features

- **Comprehensive Data Extraction**: Retrieve essential details such as:
  - Post title
  - Author
  - Creation timestamp
  - Number of comments
  - Score (upvotes)
  - Permalink
  - Image and thumbnail URLs (if available)
  - Post body content
  - Comments

- **Flexible Input Parameters**: Customize your scraping with options like:
  - Subreddit name
  - Post limit
  - Post category (hot, new, top, rising)
  - Time filter (hour, day, week, month, year, all)

- **Structured Output**: Export the collected data in JSON format for seamless integration with analytical tools.

### Usage

#### Input Configuration

The scraper accepts the following input parameters:

1. **Subreddit Name**:
   - Specify the subreddit you want to scrape.
   - Example:
     ```json
     {
       "subreddit_name": "worldnews",
        "limit": 10,
        "proxy_configuration": {
            "useApifyProxy": true,
            "apifyProxyGroups": [
                "RESIDENTIAL"
            ]
        }
     }
     ```

2. **Limit**:
   - Set the number of posts to scrape (minimum: 1, default: 1).

3. **Category**:
   - Choose from "hot", "new", "top", or "rising" posts.

4. **Time Filter**:
   - Specify a time range for "top" category posts (hour, day, week, month, year, all).

5. **Proxy Configuration**:
   - Enable or disable Apify proxy settings.
   - **It is recommended to enable proxies to avoid potential bans when scraping large amounts of data.**

#### Output Data

The scraper collects the following information:

- Title
- Author
- Created UTC timestamp
- Number of comments
- Score
- Permalink (direct link to the post)
- Image URL
- Thumbnail URL
- Post body text
- Comments (if available)

The output is stored in JSON format, allowing easy data processing.

### Quick Start

1. Install the scraper from the [Apify Marketplace](https://apify.com).
2. Configure the input parameters in the input schema.
3. Run the scraper and download the output in JSON format.

### Example Use Cases

- **Trend Monitoring**: Track the most popular discussions on specific subreddits.
- **Sentiment Analysis**: Analyze user sentiment based on post and comment content.
- **Content Aggregation**: Gather data for news feeds, blogs, or research purposes.
- **Competitive Analysis**: Monitor engagement and popularity of competitors' content.

### Output Storage

The scraper stores results in a structured dataset, allowing easy access to:

- Title
- URL
- Post metadata
- Comments
- Images (if applicable)

### Output Example

```json
{
  "title": "Major news event",
  "author": "reddit_user123",
  "created_utc": 1700000000,
  "num_comments": 256,
  "score": 1500,
  "permalink": "https://www.reddit.com/r/worldnews/comments/example",
  "image_url": "https://preview.redd.it/example.jpg",
  "thumbnail_url": "https://b.thumbs.redditmedia.com/example.jpg",
  "body": "This is the post content.",
  "comments": [
    {
      "author": "commenter1",
      "body": "Interesting perspective!",
      "score": 120
    },
    {
      "author": "commenter2",
      "body": "I disagree because...",
      "score": 85
    }
  ]
}
```

### Feedback and Support

For questions, feature requests, or support, visit the [Apify community forum](https://forum.apify.com) or contact us directly through the Apify platform.

### Explore More Actors

✨ **Looking for additional solutions?** Check out more actors on Apify that can help with your web automation and data extraction needs. Discover a wide range of tools tailored for different scenarios at 🌐 [Explore Vulnv's Actors on Apify](https://apify.com/vulnv).

📧 **Need higher volume, custom fields, or a managed data pipeline?** Email us at apify@vulnv.com — we build bespoke scrapers and managed feeds for teams. Questions and support welcome too.

# Actor input Schema

## `subreddit_name` (type: `string`):

The name of the subreddit to scrape

## `limit` (type: `integer`):

The number of posts to scrape

## `category` (type: `string`):

The category of posts to scrape

## `time_filter` (type: `string`):

The time filter for the posts

## `proxy_configuration` (type: `object`):

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "subreddit_name": "worldnews",
  "limit": 1,
  "category": "hot",
  "time_filter": "day",
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "proxy_configuration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("vulnv/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 = { "proxy_configuration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    } }

# Run the Actor and wait for it to finish
run = client.actor("vulnv/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 '{
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call vulnv/reddit-posts-scraper --silent --output-dataset

```

## MCP server setup

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