# Reddit Posts Search Scraper (`easyapi/reddit-posts-search-scraper`) Actor

Extract Reddit posts from search results with rich metadata, including media content, engagement metrics, and community information. Perfect for content research, trend analysis, and social media monitoring across Reddit communities.

- **URL**: https://apify.com/easyapi/reddit-posts-search-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Social media
- **Stats:** 687 total users, 13 monthly users, 94.9% runs succeeded, 12 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $4.99 / 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.

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

Extract Reddit posts from search results with comprehensive metadata and advanced filtering capabilities.

### 🌟 Features

- Search and extract posts from Reddit search results
- Support for multiple content types (text, images, videos, galleries)
- Advanced sorting options (relevance, top, new, comments, hot)
- Time-based filtering (hour, day, week, month, year, all)
- Safe search toggle
- Configurable maximum items limit

### 📊 Output Data Structure

Each scraped post includes:

- Post ID and metadata
- Subreddit information and icon
- Author ID
- Creation timestamp (ISO format)
- Post title and URL
- Content type and media details
- Engagement metrics (score, votes, comments)
- Content flags (NSFW, spoiler, archived)

### 💡 Use Cases

- Content research and analysis
- Trend monitoring
- Market research
- Community engagement tracking
- Social media analytics
- Academic research
- Competitive analysis
- Content curation

### 🔧 Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| query | String | Search keyword or phrase |
| sort | String | Sort results by: 'relevance', 'top', 'new', 'comments', or 'hot' |
| time | String | Time range filter: 'hour', 'day', 'week', 'month', 'year', or 'all' |
| safeSearch | String | Enable/disable safe search ('0' for safe, '1' for unsafe) |
| maxItems | Integer | Maximum number of items to scrape |

#### Input Example

A full explanation of an input example in JSON.

```
{
    "query": "ai",
    "sort": "relevance",
    "time": "all",
    "safeSearch": "0",
    "maxItems": 45
}
```

#### Output sample

The results will be wrapped into a dataset which you can always find in the **Storage** tab. Here's an excerpt from the data you'd get if you apply the input parameters above:

And here is the same data but in JSON. You can choose in which format to download your data: JSON, JSONL, Excel spreadsheet, HTML table, CSV, or XML.

```
[
	{
		"post_id": "t3_1epeshq",
		"subreddit": "ChatGPT",
		"author_id": "t2_rpv4m",
		"created_time": "2024-08-11T07:12:08.989Z",
		"title": "These are all AI",
		"type": "gallery",
		"url": "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/",
		"score": 23116,
		"comments": 3483,
		"nsfw": false,
		"spoiler": false,
		"archived": false,
		"media_type": "image",
		"image": {
			"src": "https://b.thumbs.redditmedia.com/wvxCY7MShbjFKif0kFCyClFLmBePLldkbjJtQ7RZOZY.jpg",
			"alt": "These are all AI"
		},
		"votes": 23116,
		"subreddit_icon": "https://styles.redditmedia.com/t5_7hqomg/styles/communityIcon_bzj6d1z1oizc1.png"
	},
	{
		"post_id": "t3_1et27wq",
		"subreddit": "aivideo",
		"author_id": "t2_xq6eif4up",
		"created_time": "2024-08-15T18:15:18.039Z",
		"title": "Guys immitating AI videos accurately. The circle is complete",
		"type": "video",
		"url": "https://www.reddit.com/r/aivideo/comments/1et27wq/guys_immitating_ai_videos_accurately_the_circle/",
		"score": 37528,
		"comments": 574,
		"nsfw": false,
		"spoiler": false,
		"archived": false,
		"media_type": "image",
		"image": {
			"src": "https://external-preview.redd.it/bTNyZDB1ZjBkdmlkMVEnbl5Az5JTDsoBWZ_GgLpFsAe8uNFoI11saBoGoM5N.png?width=140&height=140&crop=140:140,smart&format=jpg&v=enabled&lthumb=true&s=377a54e68d8c64d87c354e63a0d740bfca6beab5",
			"alt": "Guys immitating AI videos accurately. The circle is complete"
		},
		"votes": 37528,
		"subreddit_icon": "https://styles.redditmedia.com/t5_fwb59/styles/communityIcon_zhuecbirl3pc1.png"
	},
    ...
]
```

### Related Actors

- 💬 [Reddit Comments Scraper](https://apify.com/easyapi/reddit-comments-scraper) - Extract Reddit comments with complete thread structure and engagement metrics
- 🔍 [SubReddit Comments Search Scraper](https://apify.com/easyapi/subreddit-comments-search-scraper) - Extract Reddit comments from any subreddit's search results with advanced filtering
- 🌐 [Reddit Communities Search Scraper](https://apify.com/easyapi/reddit-communities-search-scraper) - Extract Reddit communities with comprehensive metadata and member counts
- 🔍 [Reddit Comments Search Scraper](https://apify.com/easyapi/reddit-comments-search-scraper) - Search and extract Reddit comments with advanced filtering options
- 📊 [Reddit Trends Scraper](https://apify.com/easyapi/reddit-trends-scraper) - Extract trending posts and discussions from Reddit with engagement metrics
- 🎥 [Reddit Media Search Scraper](https://apify.com/easyapi/reddit-media-search-scraper) - Extract media posts from Reddit's search results with rich metadata
- 🎬 [SubReddit Media Search Scraper](https://apify.com/easyapi/subreddit-media-search-scraper) - Extract media content from Reddit subreddit search results
- 📥 [Reddit Media Downloader](https://apify.com/easyapi/reddit-media-downloader) - Download high-quality videos, GIFs, and images from Reddit posts
- 📧 [All-in-One Social Media Email Scraper](https://apify.com/easyapi/all-in-one-social-media-email-scraper) - Discover emails across 30+ social platforms including Reddit
- 📱 [All-in-One Social Media Phone Number Scraper](https://apify.com/easyapi/all-in-one-social-media-phone-number-scraper) - Extract phone numbers from 30+ social platforms
- 🎥 [All-in-One Media Downloader](https://apify.com/easyapi/all-in-one-media-downloader) - Download videos and images from various platforms including Reddit
- 🔍 [Keyword Discovery Tool](https://apify.com/easyapi/keyword-discovery-tool) - Discover new keyword ideas and search insights for content optimization
- 🔍 [Keyword Suggestions Scraper](https://apify.com/easyapi/keyword-suggestions-scraper) - Get keyword suggestions from multiple search engines and platforms
- 📄 [Article Content Extractor](https://apify.com/easyapi/article-content-extractor) - Extract clean article content and metadata from any web page
- 🤖 [AI-powered Search](https://apify.com/easyapi/ai-powered-search) - Get AI-enhanced search summaries with references and optimization tips

# Actor input Schema

## `query` (type: `string`):

Keyword or phrase to search for

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

How to sort the search results

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

Time range for the search results

## `safeSearch` (type: `string`):

Enable or disable safe search

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

Maximum number of items to scrape (default: 100)

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

Optionally, use Apify Proxy or custom HTTP proxy to avoid IP address-based blocking.

## Actor input object example

```json
{
  "query": "ai",
  "sort": "relevance",
  "time": "all",
  "safeSearch": "0",
  "maxItems": 100,
  "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 = {
    "query": "ai",
    "sort": "relevance",
    "time": "all",
    "safeSearch": "0",
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/reddit-posts-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 = {
    "query": "ai",
    "sort": "relevance",
    "time": "all",
    "safeSearch": "0",
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/reddit-posts-search-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 '{
  "query": "ai",
  "sort": "relevance",
  "time": "all",
  "safeSearch": "0",
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call easyapi/reddit-posts-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,easyapi/reddit-posts-search-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/9tC5hyQSyOISZh1AK/builds/GxP2yb8hNbJUOpOwp/openapi.json
