# Reddit Scraper | Posts, Comments, Search & Subreddits (`resounding_diplomacy/reddit-trending-posts-scraper`) Actor

Scrape Reddit posts, comments, search results, and user profiles from any subreddit. Sort by hot, new, top, or rising. Extract titles, scores, authors, comment counts, flairs, and permalinks. Monitor communities and track trends. Export as JSON or CSV, run via API, or schedule recurring runs.

- **URL**: https://apify.com/resounding\_diplomacy/reddit-trending-posts-scraper.md
- **Developed by:** [alars num](https://apify.com/resounding_diplomacy) (community)
- **Categories:** Social media, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Trending Posts Scraper

Scrape Reddit posts from any subreddit, search results, or user profile. Extract titles, scores, comment counts, authors, flairs, thumbnails, and self-post previews as structured JSON. No API key, OAuth, or Reddit login required.

This actor scrapes old.reddit.com (the lightweight HTML interface) using CheerioCrawler for fast and reliable extraction, with built-in proxy support and automatic pagination to reach your desired item count. Export to JSON, CSV, Excel, or via API.

### Features

- Three modes: **subreddit**, **search**, and **user** profile
- Subreddit sort options: hot, new, top, rising
- Time period filter for top posts: hour, day, week, month, year, all
- Full-text search across all of Reddit
- Automatic pagination to reach `maxItems`
- Built-in input validation with clear error messages
- Proxy rotation support for reliable access and rate-limit avoidance
- Extracts post ID, rank, title, author, score, URL, permalink, comment count, subreddit, timestamp, flair, NSFW flag, domain, thumbnail, self-post indicator, and body preview

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | String | `subreddit` | Scrape mode: `subreddit`, `search`, or `user` |
| `subreddit` | String | `popular` | Subreddit name (required for `subreddit` mode, without `r/` prefix) |
| `sort` | String | `hot` | Sort order for subreddit mode: `hot`, `new`, `top`, `rising` |
| `timePeriod` | String | `all` | Time filter for top posts: `hour`, `day`, `week`, `month`, `year`, `all` |
| `searchQuery` | String | `""` | Search query (required for `search` mode) |
| `searchSort` | String | `new` | Sort for search mode: `new`, `hot`, `top`, `relevance`, `comments` |
| `username` | String | `""` | Reddit username (required for `user` mode) |
| `maxItems` | Integer | `100` | Maximum number of posts to scrape |
| `proxyConfiguration` | Object | Apify proxy | Optional custom proxy configuration |

#### Example input

```json
{
    "mode": "subreddit",
    "subreddit": "programming",
    "sort": "top",
    "timePeriod": "week",
    "maxItems": 100
}
````

### Output

```json
{
    "id": "t3_vx2k4p",
    "rank": 1,
    "title": "The state of Rust in 2026",
    "author": "rustacean",
    "score": 3420,
    "url": "https://example.com/article",
    "permalink": "https://www.reddit.com/r/programming/comments/vx2k4p/the_state_of_rust_in_2026/",
    "numComments": 512,
    "subreddit": "programming",
    "createdAt": "2026-06-30T14:22:00.000Z",
    "flair": "Discussion",
    "isStickied": false,
    "isNSFW": false,
    "domain": "example.com",
    "thumbnail": "https://...",
    "isSelfPost": false,
    "bodyPreview": "",
    "scrapedAt": "2026-07-04T10:30:00.000Z"
}
```

### Use cases

- **Market research** — monitor what products and topics are trending in niche communities
- **Brand monitoring** — track mentions of your brand, product, or competitors across subreddits
- **Content discovery** — surface viral content for newsletters, social media, or aggregation
- **Sentiment analysis** — collect post data for NLP pipelines to gauge community sentiment
- **Lead generation** — identify active community members and influencers in specific niches
- **Trend detection** — track rising posts before they hit the front page

### How to use

1. Open the actor on the Apify Store.
2. Choose a `mode`: `subreddit`, `search`, or `user`.
3. Fill in the required field for your mode (subreddit name, search query, or username).
4. Set `sort`, `timePeriod`, and `maxItems` as needed.
5. Click **Start** and export results to JSON, CSV, Excel, or via API.

Schedule recurring runs to monitor subreddits continuously or track search terms over time.

# Actor input Schema

## `mode` (type: `string`):

Choose what to scrape: subreddit posts, search results, or user submissions.

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

Subreddit name without the r/ prefix. Used when mode is 'subreddit'. Examples: technology, worldnews, AskReddit.

## `searchQuery` (type: `string`):

Search query for Reddit search. Used when mode is 'search'. Supports Reddit search syntax (e.g., 'cats site:imgur.com').

## `searchSort` (type: `string`):

Sort order for search results. Used when mode is 'search'.

## `username` (type: `string`):

Reddit username to scrape submissions from. Used when mode is 'user'. Do not include the u/ prefix.

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

Sort order for subreddit posts. Used when mode is 'subreddit'.

## `timePeriod` (type: `string`):

Time filter for 'top' sort. Only applies when sort is set to 'top'. Filters posts from the selected time range.

## `maxItems` (type: `integer`):

Maximum number of posts to scrape. Pagination is handled automatically.

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

Proxy settings for the crawler. Using Apify Proxy is recommended to avoid rate limiting by Reddit.

## Actor input object example

```json
{
  "mode": "subreddit",
  "subreddit": "popular",
  "searchQuery": "",
  "searchSort": "new",
  "username": "",
  "sort": "hot",
  "timePeriod": "all",
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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("resounding_diplomacy/reddit-trending-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("resounding_diplomacy/reddit-trending-posts-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 '{}' |
apify call resounding_diplomacy/reddit-trending-posts-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Scraper | Posts, Comments, Search & Subreddits",
        "description": "Scrape Reddit posts, comments, search results, and user profiles from any subreddit. Sort by hot, new, top, or rising. Extract titles, scores, authors, comment counts, flairs, and permalinks. Monitor communities and track trends. Export as JSON or CSV, run via API, or schedule recurring runs.",
        "version": "0.0",
        "x-build-id": "quFr7Js4SNdwtwfXf"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/resounding_diplomacy~reddit-trending-posts-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-resounding_diplomacy-reddit-trending-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/resounding_diplomacy~reddit-trending-posts-scraper/runs": {
            "post": {
                "operationId": "runs-sync-resounding_diplomacy-reddit-trending-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/resounding_diplomacy~reddit-trending-posts-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-resounding_diplomacy-reddit-trending-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Scraping Mode",
                        "enum": [
                            "subreddit",
                            "search",
                            "user"
                        ],
                        "type": "string",
                        "description": "Choose what to scrape: subreddit posts, search results, or user submissions.",
                        "default": "subreddit"
                    },
                    "subreddit": {
                        "title": "Subreddit",
                        "type": "string",
                        "description": "Subreddit name without the r/ prefix. Used when mode is 'subreddit'. Examples: technology, worldnews, AskReddit.",
                        "default": "popular"
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Search query for Reddit search. Used when mode is 'search'. Supports Reddit search syntax (e.g., 'cats site:imgur.com').",
                        "default": ""
                    },
                    "searchSort": {
                        "title": "Search Sort",
                        "enum": [
                            "new",
                            "hot",
                            "relevance",
                            "top",
                            "comments"
                        ],
                        "type": "string",
                        "description": "Sort order for search results. Used when mode is 'search'.",
                        "default": "new"
                    },
                    "username": {
                        "title": "Username",
                        "type": "string",
                        "description": "Reddit username to scrape submissions from. Used when mode is 'user'. Do not include the u/ prefix.",
                        "default": ""
                    },
                    "sort": {
                        "title": "Sort By",
                        "enum": [
                            "hot",
                            "new",
                            "top",
                            "rising"
                        ],
                        "type": "string",
                        "description": "Sort order for subreddit posts. Used when mode is 'subreddit'.",
                        "default": "hot"
                    },
                    "timePeriod": {
                        "title": "Time Period",
                        "enum": [
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year",
                            "all"
                        ],
                        "type": "string",
                        "description": "Time filter for 'top' sort. Only applies when sort is set to 'top'. Filters posts from the selected time range.",
                        "default": "all"
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of posts to scrape. Pagination is handled automatically.",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings for the crawler. Using Apify Proxy is recommended to avoid rate limiting by Reddit.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
