# Reddit Subreddit Posts (`opspilot.cc/reddit-subreddit-posts`) Actor

📋 Reddit Subreddit Posts | What a community is talking about right now Give it one or more subreddits and get every post as a row: title, author, time, flair, score, comment count and share count. Sort by hot, new, top, rising, best or controversial, and page deeper for a longer history.

- **URL**: https://apify.com/opspilot.cc/reddit-subreddit-posts.md
- **Developed by:** [wang wei](https://apify.com/opspilot.cc) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.005 / actor start

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

> What a community is talking about right now — hot, new, top, rising or controversial, in one row per post.

### ✨ What you get

One dataset row per post:

| Field | What it is |
|---|---|
| `title` | the post title |
| `author` | username, without the `u/` prefix |
| `createdAt` | when it was posted |
| `flair` | the community's own topic label — the fastest read on what a subreddit is about |
| `score` / `isScoreHidden` | upvotes, plus a flag when Reddit hides the count |
| `commentCount` / `shareCount` | how much activity the post got |
| `previewText` | the opening of the post body |
| `isPromoted` | `true` for promoted rows (they have no author) — kept and flagged, not dropped |
| `postId` / `url` / `permalink` | the real post id and working links, so you can chain into the comments Actor |
| `subreddit` / `sort` / `position` | which community, which sort, where it sat |

The run summary adds, per subreddit: posts collected, subscriber count, median score, median comments, how many rows were promoted, and the top flairs.

### 💼 Use cases

- **Reading what a community is about in one pass** — `flair` is the community's own topic label, and the summary's `topFlairs` per subreddit tells you how the group organises itself. Faster than reading 25 post titles to work out whether r/ProductManagement is actually about product management.
- **Watching a community live** — `sort: NEW` with a recurring schedule gives you a feed of what just landed. Combine `NEW` and `TOP` in one run via the `sorts` array and you see both arrival order and what the community has historically endorsed, de-duplicated by post id.
- **Deciding whether a post deserves a deeper read** — `commentCount` alongside `score` separates a controversial post that everyone argued about from a quiet one that nobody touched, so you know which `postId` to hand to the comments Actor.
- **Benchmarking which topics earn attention** — the per-subreddit medians in the summary (median score, median comments) plus `topFlairs` let you compare communities on the same footing instead of eyeballing their front pages, which are sorted differently in every sub.

### ✅ Who this is for

- **Community and social managers** who own a subreddit's presence and need to know what is being discussed there today, not what a search engine cached last month.
- **Content strategists** looking for the subjects a niche community actually organises around, using the community's own `flair` vocabulary rather than invented keywords.
- **Product teams doing lightweight market listening** — monitoring 20 communities in one run and comparing median score and median comment counts across them to see where conversation is concentrated.
- **Researchers who need the post list first** — take the `postId` values and chain them into the Reddit Post Comments Actor when a single thread deserves the full treatment.

### ❌ Who this is NOT for

- **Reading a score as organic engagement** — feeds mix promoted rows into the listing, and `isPromoted: true` rows have no author with scores that are not organic. The summary counts them, but if you skip that filter your "median score" is partly advertising budget. Filter on `isPromoted` before comparing communities.
- **Trusting a score where `isScoreHidden` is true** — Reddit is deliberately not showing the real count on those rows. That number is unreliable and will quietly skew a median or a ranking built across subreddits.
- **Communities that don't use flairs** — `flair` is often empty, and that is not a bug. If topic research is the goal, a sub without flairs gives you far less than the same run on a sub that uses them.
- **Naming a community by dot or dash** — invalid names are rejected up front because Reddit silently returns an empty feed for them, so a typo reads as "this sub is dead" rather than as an error. Also note that a quiet or restricted community returns no posts and appears in `warnings` instead of failing the run.
- **Anything needing comments, post bodies or a subreddit-level firehose** — this is the post listing: `previewText` is only the opening of the body. For the full text and the reply tree you need the Reddit Post Comments Actor on a specific `postId`; for exhaustive historical coverage this single feed page per sort is not it.

### 🚀 Quick start

1. Open the Actor and press **Start** (defaults to `r/ProductManagement`, sorted by NEW).
2. Add your own subreddits — `r/name`, `name` or a full URL all work.
3. Use `topFlairs` in the summary to see instantly which topics a community organises itself around.

### 📥 Input parameters

| Parameter | Type | Default | What it does |
|---|---|---|---|
| `subreddits` | list | `r/ProductManagement` | Communities to pull, one per line, up to 20 per run. |
| `sort` | select | `NEW` | `NEW` (live monitoring), `HOT`, `TOP`, `RISING` (breaking out), `BEST`, `CONTROVERSIAL`. |
| `maxPostsPerSubreddit` | number | `25` | Cap per subreddit (1–100). Cost scales linearly with posts × subreddits. |

### 📤 Output

- **Dataset** — one row per post (or a notice when nothing was collected)
- **SUMMARY** — per-subreddit stats, medians, top flairs, warnings

### ⚙️ How it works

1. Each input is reduced to a subreddit name; invalid names (dots, dashes) are rejected up front because Reddit silently returns an empty feed for them.
2. The feed is paged with Reddit's own cursor, de-duplicated by post id, and each group of cells is reassembled into a single post row.
3. Promoted rows are flagged rather than dropped — losing them silently would make the post count look wrong.
4. Subscriber count is fetched once per subreddit for context.

### 💰 Billing

**Billed per run.** A single `apify-actor-start` charge applies when the run begins, at the price shown on this Actor's page. A run that returns 300 rows costs the same as one that returns 3. There is no daily run cap.

**Free plan limit.** One run collects **5 subreddits over 2 pages, 50 posts each**. That is a hard ceiling on the upstream cost, so it cannot be raised from the input form. A capped run still succeeds: it writes a `notice` row to the dataset, sets `appliedLimits.capped: true` in `SUMMARY`, and logs why. Any paid Apify plan lifts the cap to 20 subreddits over 5 pages.

### ❓ FAQ

**Why does `score` sometimes look too low?**
Subreddit feeds mix promoted posts into the listing. Check `isPromoted` — those rows have no author and their scores are not organic. The summary reports how many there were.

**Is `isScoreHidden` important?**
Yes: when it is `true` Reddit is not showing the real count, so treat the number as unreliable for that row.

**Why is `flair` often empty?**
Not every community uses flairs. When they do, they are the most valuable column for topic research.

**Can I combine several sorts?**
Yes — set `sorts` with an array of sorts in the input JSON to pull NEW and TOP in one run, de-duplicated by post id.

**Can I get the comments too?**
Take the `postId` values and feed them to the Reddit Post Comments Actor.

### 📚 Resources

- Reddit public feed data (no login required)
- Apify free plan: monthly credit covers usage, no separate daily cap

# Changelog

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

# Actor input Schema

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

One per line, up to 20 per run. Accepts r/ProductManagement, ProductManagement or a full reddit.com URL.

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

New for live monitoring, rising for what is about to break out, controversial for what the community is arguing about.

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

Cap on collected posts per subreddit. Cost scales linearly with posts × subreddits.

## Actor input object example

```json
{
  "subreddits": [
    "r/ProductManagement"
  ],
  "sort": "NEW",
  "maxPostsPerSubreddit": 25
}
```

# Actor output Schema

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

One row per post, or a single notice when nothing was collected.

## `summary` (type: `string`):

Per-subreddit stats, median scores, top flairs and warnings.

# 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("opspilot.cc/reddit-subreddit-posts").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("opspilot.cc/reddit-subreddit-posts").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 opspilot.cc/reddit-subreddit-posts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,opspilot.cc/reddit-subreddit-posts"
        }
    }
}
```

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/oOHXM50Hz3WtB5QPe/builds/iFpZvb21rbOIUGZzN/openapi.json
