# Reddit Image & Video Scraper | Subreddit Media API (`andok/subreddit-media-downloader`) Actor

Instantly scrape direct, high-res image and video URLs from any Subreddit. Harvest massive media datasets for AI vision training and content curation.

- **URL**: https://apify.com/andok/subreddit-media-downloader.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** Social media, AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 58 total users, 5 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.47 / 1,000 media downloadeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Subreddit Media Downloader

Download and archive images, videos, and GIFs from any subreddit for research, content curation, or dataset building. Scans subreddit listings via Reddit's public JSON endpoints and extracts direct media URLs from Reddit-hosted content, Imgur, and inline media — no browser or API key required.

### Features

- **Image extraction** — find direct URLs for JPG, PNG, and JPEG images from posts
- **Video & GIF support** — extract Reddit-hosted videos, GIFs, and MP4 files
- **Imgur detection** — recognize and extract Imgur-hosted media links
- **Sort control** — scan by hot, new, or top posts to target specific content
- **Bulk processing** — scan multiple subreddits in a single run with up to 500 items each
- **Structured metadata** — each media item includes post title, author, score, and permalink

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `subreddits` | `array` | Yes | — | List of subreddit names to scan (e.g., `pics`, `wallpapers`) |
| `sort` | `string` | No | `hot` | Sort order for the subreddit listing: `hot`, `new`, or `top` |
| `maxItems` | `integer` | No | `100` | Maximum number of media items to extract per subreddit (1-500) |
| `timeoutSeconds` | `integer` | No | `15` | HTTP request timeout in seconds (1-120) |

#### Input Example

```json
{
  "subreddits": ["pics", "wallpapers", "EarthPorn"],
  "sort": "top",
  "maxItems": 50,
  "timeoutSeconds": 15
}
```

### Output

Each dataset item represents one media file found in a subreddit post, with the direct URL and post metadata.

Key fields:

- `subreddit` (string) — subreddit name
- `title` (string) — post title containing the media
- `mediaUrl` (string) — direct URL to the image, video, or GIF
- `mediaType` (string) — type of media: `image`, `video`, `gif/video`, or `image (imgur)`
- `author` (string) — Reddit username of the poster
- `score` (number) — net upvotes on the post
- `permalink` (string) — full URL to the original Reddit post

#### Output Example

```json
{
  "subreddit": "EarthPorn",
  "title": "Sunrise over the Swiss Alps [OC] [4032x3024]",
  "mediaUrl": "https://i.redd.it/abc123def456.jpg",
  "mediaType": "image",
  "author": "nature_photographer",
  "score": 12850,
  "permalink": "https://www.reddit.com/r/EarthPorn/comments/1x2y3z/sunrise_over_the_swiss_alps/"
}
```

### Pricing

| Event | Cost |
|-------|------|
| Media Downloaded | Included in platform usage |

You are charged per media item extracted. The actor respects the per-run max charge limit — processing stops automatically when the budget is reached.

### Use Cases

- **Visual research** — collect reference images from niche communities for design or analysis
- **Dataset building** — gather labeled image datasets for machine learning training
- **Content curation** — source high-quality visuals from photography and art subreddits
- **Brand monitoring** — track visual content posted about your brand or products
- **Archiving** — preserve media from subreddits before content is removed or deleted

### Related Actors

| Actor | What it adds |
|-------|-------------|
| [Reddit Post & Comment Scraper](https://apify.com/andok/reddit-json-scraper) | Extract the text content and discussions alongside the media |
| [Wayback Machine Scraper](https://apify.com/andok/wayback-machine-scraper) | Archive Reddit pages and media for long-term preservation |

### Notes

- Only posts with direct media links are extracted. Gallery posts, external links, and text-only posts are skipped.
- Reddit's public JSON endpoints return up to 100 posts per listing page. For subreddits with fewer media posts, the actual count may be lower than `maxItems`.
- Private or quarantined subreddits will return an error in the output.

# Actor input Schema

## `subreddits` (type: `array`):

Subreddit names to scan for media. Enter names without the r/ prefix (e.g., pics, wallpapers, EarthPorn).

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

Sort order for the subreddit listing. Use 'top' for highest-rated content or 'new' for the latest posts.

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

Maximum number of media items (images, videos, GIFs) to extract per subreddit.

## `timeoutSeconds` (type: `integer`):

HTTP request timeout in seconds. Increase if you experience timeouts on slow connections.

## Actor input object example

```json
{
  "subreddits": [
    "pics"
  ],
  "sort": "hot",
  "maxItems": 100,
  "timeoutSeconds": 15
}
```

# Actor output Schema

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

No description

## `resultsCsv` (type: `string`):

No description

## `run` (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 = {
    "subreddits": [
        "pics"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/subreddit-media-downloader").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 = { "subreddits": ["pics"] }

# Run the Actor and wait for it to finish
run = client.actor("andok/subreddit-media-downloader").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 '{
  "subreddits": [
    "pics"
  ]
}' |
apify call andok/subreddit-media-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,andok/subreddit-media-downloader"
        }
    }
}
```

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/7KbdymyarnQu1I3nr/builds/hyUjnFOqhPzFhNXb1/openapi.json
