# SubReddit Media Search Scraper (`easyapi/subreddit-media-search-scraper`) Actor

Extract media content (images and videos) from Reddit subreddit search results with advanced filtering options. Perfect for content analysis, trend monitoring, and media collection from specific communities.

- **URL**: https://apify.com/easyapi/subreddit-media-search-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Social media
- **Stats:** 30 total users, 1 monthly users, 89.7% runs succeeded, 4 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?

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

## SubReddit Media Search Scraper 🎯

Advanced Reddit scraper that extracts media content (images and videos) from subreddit search results with rich metadata.

### 🌟 Features

- Search and extract media posts from any subreddit
- Support for multiple media types (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 basic metadata
- Subreddit information
- Author details
- Creation timestamp (ISO format)
- Post title and URL
- Engagement metrics (score, comments)
- Content flags (NSFW, spoiler, archived)
- Media details:
  - For images: source URL, srcset, alt text
  - For videos: source URL, poster image, duration, dimensions

### 💡 Use Cases

- Content curation and analysis
- Social media monitoring
- Market research
- Trend analysis
- Digital asset collection
- Community engagement tracking
- Visual content research
- Meme tracking and analysis

### 🔧 Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| query | String | Search keyword or phrase |
| subReddit | String | Target subreddit name (without 'r/') |
| 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",
    "subReddit": "ChatGPT",
    "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_1ettmf9",
		"subreddit": "AppIdeas",
		"author_id": "t2_t4okkrvf",
		"created_time": "2024-08-16T16:42:26.663Z",
		"title": "I created a platform that gives you tasks based on the goals you want to achieve. Called https://plani.ai/",
		"type": "image",
		"url": "https://www.reddit.com/r/AppIdeas/comments/1ettmf9/i_created_a_platform_that_gives_you_tasks_based/",
		"score": 0,
		"comments": 8,
		"nsfw": false,
		"spoiler": false,
		"archived": false,
		"media_type": "image",
		"image": {
			"src": "https://preview.redd.it/i-created-a-platform-that-gives-you-tasks-based-on-the-v0-powbj1x412jd1.png?width=640&crop=smart&auto=webp&s=8e871070ac1afee2445314d781acef6dac720c31",
			"alt": "r/AppIdeas"
		}
	},
	{
		"post_id": "t3_1emdp7k",
		"subreddit": "AppIdeas",
		"author_id": "t2_bpicyhlm",
		"created_time": "2024-08-07T14:47:33.839Z",
		"title": "Working on an idea to capture tasks using voice and then auto cateogize them with AI. I think this will be useful when you want to capture thoughts when driving or jogging. Let me know if this will be useful? Got plans of integrating it with Google Calendar and Trello, but that'll come later.",
		"type": "video",
		"url": "https://www.reddit.com/r/AppIdeas/comments/1emdp7k/working_on_an_idea_to_capture_tasks_using_voice/",
		"score": 7,
		"comments": 2,
		"nsfw": false,
		"spoiler": false,
		"archived": false,
		"media_type": "video",
		"video": {
			"poster": "https://external-preview.redd.it/working-on-an-idea-to-capture-tasks-using-voice-and-then-v0-Zjg3aml6dm04OWhkMekSC856TfBJbyYqHyM9L9mPIdzo9IlgPmCqbXrSpK3W.png?format=pjpg&auto=webp&s=d1584f39adc99497814286181d29c9fa83c0f216",
			"src": "https://packaged-media.redd.it/xpbem0wm89hd1/pb/m2-res_392p.mp4?m=DASHPlaylist.mpd&v=1&e=1730710800&s=3573eb993b5aed13269b7ee00be788708a11462e",
			"duration": 117,
			"dimensions": {
				"width": 202,
				"height": 392
			}
		}
	},
    ...
]
```

# Actor input Schema

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

Keyword or phrase to search for

## `subReddit` (type: `string`):

Target subreddit name (without 'r/')

## `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",
  "subReddit": "AppIdeas",
  "sort": "relevance",
  "time": "all",
  "safeSearch": "0",
  "maxItems": 30,
  "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",
    "subReddit": "AppIdeas",
    "sort": "relevance",
    "time": "all",
    "safeSearch": "0",
    "maxItems": 30,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,easyapi/subreddit-media-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/kVePikaKqh8rYD5SB/builds/fUylKXHo2mhEYGvG1/openapi.json
