# Stallion Reddit Scraper (`busy_evidence/stallion-reddit-scraper`) Actor

Scrape Reddit posts, comments, subreddit listings, and keyword search via public JSON API. Drop-in compatible with reddit-scraper-lite input/output. No login required.

- **URL**: https://apify.com/busy\_evidence/stallion-reddit-scraper.md
- **Developed by:** [Stallion S](https://apify.com/busy_evidence) (community)
- **Categories:** E-commerce, Social media, Automation
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.40 / 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

## Stallion Reddit Scraper

**Apify Store:** [busy\_evidence/stallion-reddit-scraper](https://apify.com/busy_evidence/stallion-reddit-scraper)

Fast, lightweight Reddit scraper for Apify. Collect posts from subreddit listings, keyword search, and individual post URLs — **no Reddit login required**. Uses efficient HTTP requests instead of a headless browser, so runs are typically faster and cheaper.

> **Disclaimer:** This is an unofficial scraper and is not affiliated with Reddit Inc. Reddit may change access rules at any time. Use responsibly and respect Reddit's terms of service.

***

### Why use this Reddit Scraper?

| | This Actor | Typical browser scrapers |
|---|---|---|
| **Speed** | Seconds per listing page | Minutes (page render + scroll) |
| **Cost** | Low memory (256–1024 MB) | High memory (browser overhead) |
| **Proxy usage** | Residential proxy for listings | Residential + browser sessions |

**Best for:** monitoring subreddits, lead generation, sentiment pipelines, research datasets, and scheduled jobs where you need posts fast at predictable per-result pricing.

**For full comment threads and vote counts on every field**, set `maxComments` above `0` when JSON access is available, or use a browser-based scraper for maximum coverage.

***

### Features

- **Browse subreddits** — `new`, `hot`, `top`, `rising`, `controversial`
- **Keyword search** — global or scoped to one subreddit (`searchCommunityName`)
- **Single post URLs** — scrape one thread by URL
- **Nested comments** — when `maxComments > 0` (see limitations below)
- **Date filters** — `postDateLimit` / `commentDateLimit` (`YYYY-MM-DD`)
- **NSFW toggle** — `includeNSFW`
- **Pagination resume** — pass `?after=t3_…` in start URLs
- **Search → browse fallback** — empty niche search falls back to subreddit listing
- **RSS fallback** — when Reddit blocks JSON (common in 2026), listings use public Atom feeds automatically

***

### How it works

1. **Phase 1 — Discovery:** listing or search URLs are crawled; post stubs are collected.
2. **Phase 2 — Enrichment (optional):** when `maxComments > 0`, each post is fetched again for full body + comments.

**Data sources:**

| Source | When used | What you get |
|---|---|---|
| `json` | Reddit JSON API responds | Full fields: scores, comment counts, comments |
| `rss` | JSON blocked (403) | Title, body snippet, author, URL, date — `upVotes` and `numberOfComments` are `0`; rows include `"dataSource": "rss"` |

For listing-only runs, set **`maxComments: 0`** (default). This is the fastest and most reliable mode on Apify Cloud.

**Proxy:** enable Apify Proxy with residential IPs. Reddit blocks datacenter traffic quickly.

***

### How to use

1. Open this Actor on Apify Store and click **Try for free** (or run from your private Actor page).
2. Choose a mode:
   - **Subreddit listing** → add a URL like `https://www.reddit.com/r/python/new/`
   - **Search** → leave `startUrls` empty and fill `searches`
   - **One post** → paste a `/comments/` URL
3. Set **`maxItems`** (total results cap) and **`maxComments`** (`0` for posts only).
4. Enable **proxy** → `useApifyProxy: true` (residential recommended).
5. Click **Start** and download results as JSON, CSV, Excel, or via API.

***

### Input

Provide **either** `startUrls` **or** `searches`. When `startUrls` is set, search fields are ignored.

#### Input parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `startUrls` | array | — | Subreddit listings, post URLs, or paginated listing URLs |
| `searches` | array | `[]` | Keywords (used when `startUrls` is empty) |
| `searchCommunityName` | string | — | Restrict search to one subreddit (no `r/` prefix) |
| `sort` | string | `new` | `new`, `hot`, `top`, `relevance`, `comments` |
| `time` | string | `all` | `hour`, `day`, `week`, `month`, `year`, `all` |
| `postDateLimit` | string | — | Only posts on/after `YYYY-MM-DD` |
| `commentDateLimit` | string | — | Only comments on/after `YYYY-MM-DD` |
| `maxItems` | integer | `100` | Hard cap on dataset rows |
| `maxPostCount` | integer | `100` | Max posts per listing/search page |
| `maxComments` | integer | `0` | Comments per post; `0` = skip comment fetch |
| `scrollTimeout` | integer | `40` | Seconds to keep paginating a listing |
| `includeNSFW` | boolean | `false` | Include adult content |
| `searchPosts` | boolean | `true` | Search posts when using `searches` |
| `searchComments` | boolean | `false` | Search comments |
| `searchCommunities` | boolean | `false` | Search communities |
| `searchUsers` | boolean | `false` | Search users |
| `skipComments` | boolean | `false` | Skip comments even if `maxComments > 0` |
| `includeMediaLinks` | boolean | `false` | Add image/video URLs (slower) |
| `proxy` | object | — | Apify proxy config; residential recommended |

#### Example — browse a subreddit (recommended)

```json
{
  "startUrls": [{ "url": "https://www.reddit.com/r/cartalkuk/new/" }],
  "maxItems": 100,
  "maxPostCount": 100,
  "maxComments": 0,
  "scrollTimeout": 40,
  "includeNSFW": true,
  "proxy": { "useApifyProxy": true }
}
```

#### Example — search inside a subreddit

```json
{
  "searches": ["machine learning", "data science"],
  "searchCommunityName": "python",
  "sort": "new",
  "time": "year",
  "postDateLimit": "2024-01-01",
  "maxItems": 200,
  "maxComments": 0,
  "proxy": { "useApifyProxy": true }
}
```

#### Example — one post with comments

```json
{
  "startUrls": [{
    "url": "https://www.reddit.com/r/python/comments/EXAMPLE/title_here/"
  }],
  "maxComments": 50,
  "proxy": { "useApifyProxy": true }
}
```

#### Example — resume pagination

```json
{
  "startUrls": [{
    "url": "https://www.reddit.com/r/dashcam/new/?after=t3_abc123"
  }],
  "maxItems": 100,
  "proxy": { "useApifyProxy": true }
}
```

***

### Output

Each dataset row is one **post** with a consistent, structured schema.

#### Post object

```json
{
  "dataType": "post",
  "parsedId": "abc123",
  "id": "t3_abc123",
  "url": "https://www.reddit.com/r/python/comments/abc123/title/",
  "title": "Example post title",
  "body": "Post selftext or empty for link posts",
  "parsedCommunityName": "python",
  "communityName": "r/python",
  "username": "reddit_user",
  "upVotes": 150,
  "numberOfComments": 42,
  "createdAt": "2025-08-01T12:00:00.000Z",
  "scrapedAt": "2026-07-01T12:00:00.000Z",
  "comments": [],
  "dataSource": "rss"
}
```

`dataSource` appears only when the row came from RSS fallback (`"rss"`). JSON-sourced rows omit this field.

#### Comment object (when `maxComments > 0`)

```json
{
  "parsedId": "cmt1",
  "body": "Great post!",
  "username": "reader42",
  "upVotes": 3,
  "createdAt": "2025-08-01T12:05:00.000Z",
  "parentId": "t3_abc123"
}
```

With `includeMediaLinks: true`, posts may also include `imageUrls`, `videoUrls`, `flair`, `over18`, `isVideo`, and `upVoteRatio`.

***

### Pricing

This Actor uses **Pay per event** on Apify Store:

| Event | Typical price |
|---|---|
| Actor start | ~$0.00005 per run |
| Result (`apify-default-dataset-item`) | ~$0.003 per post |

Example: **100 posts ≈ $0.30** (+ small start fee). Platform/proxy usage may apply depending on your monetization settings.

Set a **max cost per run** in the Apify Console before large jobs.

***

### API usage

Replace `YOUR_TOKEN` with your [Apify API token](https://console.apify.com/account/integrations).

Actor ID: **`busy_evidence/stallion-reddit-scraper`**

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")

run = client.actor("busy_evidence/stallion-reddit-scraper").call(run_input={
    "startUrls": [{"url": "https://www.reddit.com/r/python/new/"}],
    "maxItems": 100,
    "maxComments": 0,
    "proxy": {"useApifyProxy": True},
})

items = client.dataset(run["defaultDatasetId"]).list_items().items
print(f"Scraped {len(items)} posts")
```

#### JavaScript

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_TOKEN' });

const run = await client.actor('busy_evidence/stallion-reddit-scraper').call({
    startUrls: [{ url: 'https://www.reddit.com/r/python/new/' }],
    maxItems: 100,
    maxComments: 0,
    proxy: { useApifyProxy: true },
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Scraped ${items.length} posts`);
```

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/busy_evidence~stallion-reddit-scraper/runs?token=YOUR_TOKEN&waitForFinish=300" \
  -H "Content-Type: application/json" \
  -d '{
    "startUrls": [{"url": "https://www.reddit.com/r/python/new/"}],
    "maxItems": 100,
    "maxComments": 0,
    "proxy": {"useApifyProxy": true}
  }'
```

#### Integrations

Export results to **Google Sheets**, **Slack**, **Zapier**, **Make**, or any webhook via Apify integrations on the run's **Export** tab.

***

### FAQ

**Why enable residential proxy?**\
Reddit blocks datacenter IPs. Apify residential proxy is required for reliable runs on the platform.

**Why is `maxComments` default 0?**\
Comment fetch needs the JSON API, which Reddit often blocks. Listing scans with `maxComments: 0` use RSS fallback and complete in seconds.

**Why are `upVotes` and `numberOfComments` zero?**\
When JSON is blocked, the Actor falls back to RSS feeds which do not include scores or comment counts. The row will have `"dataSource": "rss"`.

**What is `scrollTimeout`?**\
Seconds to keep paginating before stopping (default `40`). Increase for large subreddits or slow proxy regions.

**Why fewer results than `maxItems`?**\
Reddit caps listing depth at roughly 1,000 posts per sort. Date filters and NSFW settings also reduce counts.

**Does this scrape user profiles?**\
Not yet. Supported start URLs are subreddit listings (`/r/{sub}/{sort}`) and post URLs (`/r/{sub}/comments/{id}`).

***

### Limitations

- Reddit JSON API access is restricted for unauthenticated clients (2026). Listings use RSS when needed.
- RSS rows lack vote/comment counts and cannot fetch comment threads.
- Historical listing depth is ~1,000 items per sort — use `postDateLimit` + scheduled runs for ongoing monitoring.
- Search and comment modes depend on JSON availability and may return fewer fields than browser-based scrapers.

***

### Local development

```bash
pip install -r requirements.txt
python -m pytest tests/
apify run --input='{"startUrls":[{"url":"https://www.reddit.com/r/python/new/"}],"maxItems":5,"maxComments":0}'
```

***

### Changelog

#### 0.1.8

- RSS/Atom fallback when Reddit JSON returns 403
- `dataSource: "rss"` on fallback rows
- Apify `Actor.log` for visible platform logs

#### 0.1.0

- Initial release: browse, search, and post scraping

# Actor input Schema

## `startUrls` (type: `array`):

Reddit URLs: subreddit listings, posts, users, or search pages. When set, search fields are ignored.

## `searches` (type: `array`):

Keywords for Reddit search (used when startUrls is empty).

## `searchCommunityName` (type: `string`):

Restrict search to one subreddit (name only, no r/ prefix).

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

Sort order for listings and search.

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

Time range for top/relevance search (posts only).

## `postDateLimit` (type: `string`):

Only include posts on or after this date (YYYY-MM-DD).

## `commentDateLimit` (type: `string`):

Only include comments on or after this date (YYYY-MM-DD).

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

Hard cap on total dataset rows.

## `maxPostCount` (type: `integer`):

Max posts per listing or search page.

## `maxComments` (type: `integer`):

Max comments per post. 0 = skip comment extraction.

## `scrollTimeout` (type: `integer`):

Seconds to keep paginating before stopping.

## `includeNSFW` (type: `boolean`):

Include adult content.

## `searchPosts` (type: `boolean`):

Search posts when using searches.

## `searchComments` (type: `boolean`):

Search comments when using searches.

## `searchCommunities` (type: `boolean`):

Search communities when using searches.

## `searchUsers` (type: `boolean`):

Search users when using searches.

## `skipComments` (type: `boolean`):

Skip comment extraction on post pages even if maxComments > 0.

## `includeMediaLinks` (type: `boolean`):

Include image and video URLs in output (slower).

## `proxy` (type: `object`):

Apify proxy settings. Residential proxy recommended for Reddit.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/python/new/"
    }
  ],
  "searches": [],
  "sort": "new",
  "time": "all",
  "maxItems": 100,
  "maxPostCount": 100,
  "maxComments": 0,
  "scrollTimeout": 40,
  "includeNSFW": false,
  "searchPosts": true,
  "searchComments": false,
  "searchCommunities": false,
  "searchUsers": false,
  "skipComments": false,
  "includeMediaLinks": false,
  "proxy": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/python/new/"
        }
    ],
    "searches": [],
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("busy_evidence/stallion-reddit-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 = {
    "startUrls": [{ "url": "https://www.reddit.com/r/python/new/" }],
    "searches": [],
    "proxy": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("busy_evidence/stallion-reddit-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 '{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/python/new/"
    }
  ],
  "searches": [],
  "proxy": {
    "useApifyProxy": true
  }
}' |
apify call busy_evidence/stallion-reddit-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,busy_evidence/stallion-reddit-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/JDHkZQdz6XoIhd6IJ/builds/8XHs8P54aDXWwxPcc/openapi.json
