# Reddit Search Scraper (`xtracto/reddit-search-scraper`) Actor

Search Reddit posts globally or within a subreddit. Sort by relevance/hot/new/top/comments.

- **URL**: https://apify.com/xtracto/reddit-search-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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 Search Scraper

Search Reddit posts by keyword — across all of Reddit or restricted to one subreddit — and stream a clean JSON record per post into your Apify dataset.

### Why use this actor

- **Global or subreddit-scoped** — search the entire Reddit corpus, or narrow to a single community like `r/python` for higher signal.
- **Multiple sort modes** — relevance, hot, new, top, and most-commented, paired with a time window (hour / day / week / month / year / all).
- **Bulk queries** — pass any number of keywords in one run; results from every query land in the same dataset, joinable back to your input via `_input`.
- **No account / no login required** — the public path works out of the box. An optional client ID slot is available for users who want higher rate limits on heavy jobs.
- **Automatic retries and fallbacks** — transient failures retry with exponential backoff, and the actor transparently switches data paths if one is rate-limited.
- **Stable JSON output** — every row carries `_input`, `_source`, and `_scrapedAt` envelope fields so it slots straight into pipelines, spreadsheets, and databases.

### How it works

1. You supply one or more search terms (and optionally a subreddit to restrict to, a sort mode, and a time window).
2. The actor runs each query against Reddit's search and pages through results up to your `maxPosts` limit per query.
3. Each post is normalized into a flat JSON record and streamed into the run's dataset, ready to download as JSON, CSV, or Excel.

You do not need to manage scrapers, browsers, or rotating IPs — all handled internally.

### Input

```json
{
  "queries": ["python", "machine learning"],
  "subreddit": "python",
  "sort": "new",
  "timeFilter": "all",
  "maxPosts": 25,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["DATACENTER"]
  }
}
```

| Field | Type | Description |
|---|---|---|
| `queries` | array | One or more search terms. Each query runs independently. Required. |
| `subreddit` | string | Optional subreddit name (without `r/`) to restrict the search to. Leave blank for a global search. |
| `sort` | string | `relevance` (default), `hot`, `new`, `top`, or `comments`. |
| `timeFilter` | string | `hour`, `day`, `week`, `month`, `year`, or `all`. Only meaningful for `top` / `comments` sort. |
| `maxPosts` | integer | Max posts returned per query. Default `25`. Use `0` for unlimited (Reddit caps pagination at ~1,000 per query). |
| `redditClientId` | string | Optional Reddit client ID for higher rate limits. Leave blank for the public path. |
| `proxyConfiguration` | object | Apify Proxy settings. Datacenter works for most jobs. |

### Output

Sample command:

```
python test_local.py python --max 3 --sort new
```

Three real rows from that run (each Reddit post object has ~100 fields; the most useful ones are shown — full record is what your dataset will contain):

```json
{
  "_input": "python",
  "_subreddit": null,
  "_source": "S3-fallback",
  "_scrapedAt": "2026-05-18T11:09:23.157233+00:00",
  "id": "1tgj61p",
  "name": "t3_1tgj61p",
  "subreddit": "esp32",
  "subreddit_name_prefixed": "r/esp32",
  "subreddit_subscribers": 186169,
  "subreddit_type": "public",
  "title": "Introduction Course for Esp32s3 with  Esp_IDF",
  "selftext": "There are not many guides and tutorials for ESP-IDF, most courses are covered using MicroPython or Arduino IDE and Others are Paid ones, so I built this small showcase and tutorial to be a quick start for ESP-IDF...",
  "author": "Algstud",
  "author_fullname": "t2_y5vowmd5s",
  "score": 1,
  "ups": 1,
  "downs": 0,
  "upvote_ratio": 1.0,
  "num_comments": 0,
  "num_crossposts": 0,
  "created_utc": 1779102116.0,
  "domain": "github.com",
  "url": "https://github.com/Bayt-al-Hikmah/Esp32S3",
  "permalink": "/r/esp32/comments/1tgj61p/introduction_course_for_esp32s3_with_esp_idf/",
  "link_flair_text": "I made a thing!",
  "is_self": false,
  "is_video": false,
  "over_18": false,
  "spoiler": false,
  "locked": false,
  "archived": false,
  "stickied": false,
  "thumbnail": "https://external-preview.redd.it/ytq2ya-Oo2hIRZTRqTrPcF-JSlsz3ewW0GmhJWL1PV4.png?width=140&height=70&auto=webp&s=6dbdbfb056a9edf231166b1f2e84fb410c55be53"
}
```

```json
{
  "_input": "python",
  "_subreddit": null,
  "_source": "S3-fallback",
  "_scrapedAt": "2026-05-18T11:09:23.158235+00:00",
  "id": "1tgj5uf",
  "name": "t3_1tgj5uf",
  "subreddit": "mcp",
  "subreddit_name_prefixed": "r/mcp",
  "subreddit_subscribers": 108813,
  "title": "Memcord v3.4.1",
  "selftext": "Privacy-first, self-hosted MCP server (python based) helps you organize chat history, summarize messages, search across past chats with AI...",
  "author": "Longjumping_Tie_7758",
  "score": 1,
  "ups": 1,
  "upvote_ratio": 1.0,
  "num_comments": 0,
  "created_utc": 1779102101.0,
  "domain": "self.mcp",
  "url": "https://old.reddit.com/r/mcp/comments/1tgj5uf/memcord_v341/",
  "permalink": "/r/mcp/comments/1tgj5uf/memcord_v341/",
  "link_flair_text": "resource",
  "is_self": true,
  "is_video": false,
  "over_18": false
}
```

```json
{
  "_input": "python",
  "_subreddit": null,
  "_source": "S3-fallback",
  "_scrapedAt": "2026-05-18T11:09:23.158235+00:00",
  "id": "1tgj4v7",
  "name": "t3_1tgj4v7",
  "subreddit": "grafana",
  "subreddit_name_prefixed": "r/grafana",
  "subreddit_subscribers": 24820,
  "title": "built a grafana dashboard that tracks zestimate drift across my rental portfolio and it caught a $40k valuation drop i would have missed",
  "selftext": "i own 6 rental units and i wanted a way to passively monitor what's happening with property values without manually checking zillow every week...",
  "author": "straightedge23",
  "score": 1,
  "ups": 1,
  "upvote_ratio": 1.0,
  "num_comments": 0,
  "created_utc": 1779102034.0,
  "domain": "self.grafana",
  "url": "https://old.reddit.com/r/grafana/comments/1tgj4v7/built_a_grafana_dashboard_that_tracks_zestimate/",
  "permalink": "/r/grafana/comments/1tgj4v7/built_a_grafana_dashboard_that_tracks_zestimate/",
  "link_flair_text": ":Confused: Miscellaneous",
  "is_self": true,
  "over_18": false
}
```

| Field | Type | Description |
|---|---|---|
| `_input` | string | The query you supplied, exactly as written. Use this to join results back to your input list. |
| `_subreddit` | string | null | The subreddit restriction you applied, or `null` for a global search. |
| `_source` | string | Internal tag for the data path used. `S1-primary` is the fastest path; `S2-fallback` and `S3-fallback` indicate a fallback was used (still complete data). |
| `_scrapedAt` | string | ISO-8601 UTC timestamp when the record was scraped. |
| `id` | string | Reddit post ID (the short form, e.g. `1tgj61p`). |
| `name` | string | Reddit "fullname" — `t3_` prefix + `id`. Use this when cross-referencing with the comments endpoint. |
| `subreddit` | string | Subreddit the post is in (without `r/`). |
| `subreddit_name_prefixed` | string | Display form with the `r/` prefix. |
| `subreddit_subscribers` | integer | Subscriber count of the host subreddit at scrape time. |
| `subreddit_type` | string | `public`, `restricted`, `private`, etc. |
| `title` | string | Post title. |
| `selftext` | string | Self-post body in Markdown. Empty for link posts. |
| `author` | string | Username of the poster. `[deleted]` if the author removed their account. |
| `author_fullname` | string | Reddit fullname of the author (`t2_...`). |
| `score` | integer | Post score (upvotes minus downvotes after fuzzing). |
| `ups` | integer | Fuzzed upvote count. |
| `downs` | integer | Fuzzed downvote count (Reddit returns 0 in the public API). |
| `upvote_ratio` | number | Ratio of upvotes to total votes (0.0–1.0). |
| `num_comments` | integer | Number of comments on the post. |
| `num_crossposts` | integer | Number of times the post has been crossposted. |
| `created_utc` | number | Post creation time as a UNIX timestamp. |
| `domain` | string | Outbound domain for link posts; `self.<subreddit>` for self-posts. |
| `url` | string | Outbound URL for link posts, or the Reddit comments URL for self-posts. |
| `permalink` | string | Relative path on reddit.com to the post's comments page. |
| `link_flair_text` | string | null | Flair text on the post, if any. |
| `is_self` | boolean | `true` for text/self posts. |
| `is_video` | boolean | `true` for video posts. |
| `over_18` | boolean | NSFW marker. |
| `spoiler` | boolean | Spoiler marker. |
| `locked` | boolean | `true` if comments are locked. |
| `archived` | boolean | `true` if the post is past the archive cutoff. |
| `stickied` | boolean | `true` if the post is pinned at the top of its subreddit. |
| `thumbnail` | string | Thumbnail URL, or `self` / `default` / `nsfw` placeholders. |

Each post also carries Reddit's full set of supplementary fields (media previews, awards, mod flags, gildings, etc.) — these stream through unchanged into your dataset.

#### Error envelope

Queries that fail (rate-limit, network error, all fallback paths exhausted) emit a structured error instead of crashing the run:

```json
{
  "_input": "python",
  "_error": "fetch_failed",
  "_errorDetail": "all strategies failed",
  "_source": "S3-fallback",
  "_scrapedAt": "2026-05-18T11:09:23.157233+00:00"
}
```

Filter on `_error` to triage failed rows.

### Pricing

This actor is billed per result: **$3.50 per 1,000 posts**. Each post in the dataset = 1 result. Errors are not billed.

### Other Sosmed Actors

| Platform | Actor | Best for |
|---|---|---|
| Reddit | [Reddit Subreddit Posts Scraper](https://apify.com/xtracto/reddit-subreddit-posts-scraper) | Stream the live feed of any subreddit (hot / new / top / rising). |
| Reddit | [Reddit Post Detail Scraper](https://apify.com/xtracto/reddit-post-detail-scraper) | Pull a post + its full comment tree. |
| Reddit | [Reddit User Profile Scraper](https://apify.com/xtracto/reddit-user-profile-scraper) | Karma, trophies, submitted/comments history for any user. |
| YouTube | [YouTube Search Scraper](https://apify.com/xtracto/youtube-search-scraper) | Search YouTube videos by keyword. |
| Bluesky | [Bluesky Search Scraper](https://apify.com/xtracto/bluesky-search-scraper) | Keyword search across the atproto network. |
| X / Twitter | [X Search Scraper](https://apify.com/xtracto/x-search-scraper) | Search tweets by keyword, hashtag, or user filter. |
| Mastodon | [Mastodon Account Scraper](https://apify.com/xtracto/mastodon-account-scraper) | Profile + post counts for any Mastodon handle. |

Browse the full catalog at [apify.com/xtracto](https://apify.com/xtracto).

### Notes

- **NSFW filtering** — NSFW posts come through with `over_18: true`. Filter them out in your post-processing if you don't want them.
- **Subreddit scope** — leave `subreddit` blank for a global search across all of Reddit, or set it to a community name like `python` to restrict results to that subreddit only.
- **Sort + time window** — the `timeFilter` field only changes results when sort is `top` or `comments`. For `new`, `hot`, and `relevance` it is ignored.
- **Pagination cap** — Reddit limits search pagination to roughly the first 1,000 results per query. To get more breadth, split into narrower queries (e.g. by adding date ranges or topic qualifiers).
- **Optional client ID** — provide your own Reddit client ID via `redditClientId` for higher per-IP rate limits on very large jobs. Leave it blank for normal use; the public path is the default and works without any setup.
- **Reproducibility** — `relevance` sort can shift opaquely between runs as Reddit re-ranks results. For stable comparisons across runs, prefer `new` or `top`.

# Actor input Schema

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

One or more keywords or phrases to search for. Each query runs independently and its results stream into the same dataset (joinable via the `_input` field).

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

Optional subreddit name (without `r/`) to restrict the search to. Leave blank to search all of Reddit. Example: `python`, `MachineLearning`, `news`.

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

How results are ordered. `relevance` matches Reddit's default search ranking; `new` returns the freshest posts; `top` returns the highest-scoring posts within the selected time window; `comments` ranks by discussion volume.

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

Time window for results. Only meaningful with sort `top` or `comments`. Use `day` or `week` for trend monitoring; `all` returns the full archive.

## `maxPosts` (type: `integer`):

Maximum number of posts to return per query. Set to `0` for unlimited (subject to Reddit's pagination cap of about 1,000 results per query).

## `redditClientId` (type: `string`):

Optional Reddit client ID for higher rate limits. Leave blank to use the public path — it works for most jobs. Provide your own ID only for very large or frequent runs.

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

Apify Proxy settings. A Residential proxy is required — Reddit blocks datacenter addresses, so datacenter runs return no data. This is prefilled for you.

## Actor input object example

```json
{
  "queries": [
    "python"
  ],
  "subreddit": "python",
  "sort": "new",
  "timeFilter": "all",
  "maxPosts": 25,
  "proxyConfiguration": {
    "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": [
        "python",
        "machine learning"
    ],
    "subreddit": "python",
    "sort": "new",
    "maxPosts": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/reddit-search-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 = {
    "queries": [
        "python",
        "machine learning",
    ],
    "subreddit": "python",
    "sort": "new",
    "maxPosts": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/reddit-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "python",
    "machine learning"
  ],
  "subreddit": "python",
  "sort": "new",
  "maxPosts": 25
}' |
apify call xtracto/reddit-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=xtracto/reddit-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/ZPtIlXNNv7nvg18b0/builds/Zx2ZqNfcSfoEiUWvb/openapi.json
