# 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:** 547 total users, 119 monthly users, 31.8% runs succeeded, 9 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/platform/actors/running/actors-in-store#pay-per-event

## 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 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
};

// 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,
}

# 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("💾 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 '{
  "query": "ai",
  "sort": "relevance",
  "time": "all",
  "safeSearch": "0",
  "maxItems": 100
}' |
apify call easyapi/reddit-posts-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Posts Search Scraper",
        "description": "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.",
        "version": "0.0",
        "x-build-id": "lawSDCQBcvPSj63Hx"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/easyapi~reddit-posts-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-easyapi-reddit-posts-search-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/easyapi~reddit-posts-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-easyapi-reddit-posts-search-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/easyapi~reddit-posts-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-easyapi-reddit-posts-search-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": [
                    "query"
                ],
                "properties": {
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Keyword or phrase to search for",
                        "default": "ai"
                    },
                    "sort": {
                        "title": "Sort By",
                        "enum": [
                            "relevance",
                            "top",
                            "new",
                            "comments",
                            "hot"
                        ],
                        "type": "string",
                        "description": "How to sort the search results",
                        "default": "relevance"
                    },
                    "time": {
                        "title": "Time Range",
                        "enum": [
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year",
                            "all"
                        ],
                        "type": "string",
                        "description": "Time range for the search results",
                        "default": "all"
                    },
                    "safeSearch": {
                        "title": "Safe Search",
                        "enum": [
                            "0",
                            "1"
                        ],
                        "type": "string",
                        "description": "Enable or disable safe search",
                        "default": "0"
                    },
                    "maxItems": {
                        "title": "Maximum Items",
                        "minimum": 100,
                        "type": "integer",
                        "description": "Maximum number of items to scrape (default: 100)",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Optionally, use Apify Proxy or custom HTTP proxy to avoid IP address-based blocking.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
