# Reddit Subreddit Search — Relevant Posts, Not Pasta (`modnine/reddit-subreddit-search`) Actor

Search posts inside a specific subreddit by keyword. Uses Reddit's `restrict_sr=on` for actual relevance — no more 'I searched cyber, got pasta' surprises. $1.50 per 1,000 results.

- **URL**: https://apify.com/modnine/reddit-subreddit-search.md
- **Developed by:** [Silver](https://apify.com/modnine) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 93.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 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?

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 Search Scraper

Search posts inside a specific Reddit community by keyword. Uses Reddit's `restrict_sr=on` flag to **scope the query to the subreddit** instead of relying on Reddit's noisy global search.

✅ **Scoped search** — "pytest" inside r/python returns pytest posts only, not random matches
✅ **Multiple queries per run** — one input array, results aggregated into one dataset
✅ **Standard sort options** — relevance, hot, top, new, comments
✅ **No login required**
✅ **First 100 results free**

***

### Why scoped search matters

Reddit has two search endpoints:

- **Global search** — searches all of Reddit. Relevance is famously noisy: a query like "pytest" can return pasta recipes and TV shows.
- **Subreddit-scoped search** (`restrict_sr=on`) — searches inside one community. Reddit's relevance ranker has a much smaller candidate pool, so results are accurate.

This actor defaults to scoped search whenever you set the `subreddit` field. That's the entire fix to "search returned junk" — we don't trust Reddit's global ranker.

***

### Quick start

#### Search inside one subreddit (recommended)

```json
{
  "queries": ["pytest fixtures", "asyncio"],
  "subreddit": "python",
  "sort": "relevance",
  "maxItemsPerQuery": 50
}
```

#### Global search (less precise — only if you must)

```json
{
  "queries": ["claude code"],
  "subreddit": "",
  "sort": "new",
  "maxItemsPerQuery": 5
}
```

***

### Pricing

| | |
|---|---:|
| Per actor run | $0.001 |
| Per dataset item | $0.00349 ($3.49 / 1,000) |
| Free trial | first 100 results |

***

### Use cases

- **Market research** — track how a topic is discussed in its niche subreddit
- **Lead gen** — find recent "looking for X" posts in a relevant community
- **Brand monitoring** — watch mentions in industry-specific subreddits
- **Content research** — discover what's resonating in your niche

***

### Output

Flat `post` items — same schema as the universal Reddit Scraper. Includes `author_id`, `author_flair`, `is_ad`, `media[]`, and all engagement metrics (`score`, `upvote_ratio`, `num_comments`).

***

### Need different scraping?

- **Reddit Comments Scraper** — full comment tree of a specific post
- **Reddit User Scraper** — profile + activity for a username
- **Reddit Scraper** — universal, all modes in one actor

# Actor input Schema

## `queries` (type: `array`):

One or more search terms or phrases. Reddit's relevance ranker handles short and long queries equally well.

## `subreddit` (type: `string`):

Restrict the search to this community for relevant results. Leave empty to search all of Reddit (less relevant — Reddit's global search is noisy).

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

How to rank matches.

## `time` (type: `string`):

Time filter, only meaningful when sort=top.

## `maxItemsPerQuery` (type: `integer`):

How many posts to return for each search query.

## `includeNSFW` (type: `boolean`):

If false, NSFW posts are filtered from the result set and `include_over_18=false` is sent to Reddit.

## `requestDelay` (type: `integer`):

Pause between paginated requests. 0–1 is fine for residential proxies.

## `proxy` (type: `object`):

Apify Proxy is recommended (RESIDENTIAL group). Datacenter IPs are blocked by Reddit.

## Actor input object example

```json
{
  "queries": [
    "pytest fixtures"
  ],
  "subreddit": "python",
  "sort": "relevance",
  "time": "all",
  "maxItemsPerQuery": 50,
  "includeNSFW": true,
  "requestDelay": 1,
  "proxy": {
    "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 = {
    "queries": [
        "pytest fixtures"
    ],
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("modnine/reddit-subreddit-search").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 = {
    "queries": ["pytest fixtures"],
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("modnine/reddit-subreddit-search").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 '{
  "queries": [
    "pytest fixtures"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call modnine/reddit-subreddit-search --silent --output-dataset

```

## MCP server setup

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

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/Zohbz5DoOAYkySdSr/builds/jXc5Xoa9wja3t1FgY/openapi.json
