# Reddit Scraper – Posts, Full Comment Trees & Users (`ninhothedev/reddit-scraper`) Actor

$1.5/1K 🔥 Fast Reddit scraper! Posts, comments, scores, authors & full comment trees from any subreddit or search. JSON, CSV, Excel or API in seconds. Paste a subreddit or keyword & pull thousands of posts for research & trend-tracking ⚡

- **URL**: https://apify.com/ninhothedev/reddit-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Scraper – Posts, Full Comment Trees & Users

**Scrape Reddit posts, FULL nested comment trees, user posts and search: score, upvote ratio, awards, media, AI-ready markdown and token counts. As JSON, CSV or Excel.**

### 💵 Pricing
**Pay per result — $0.001 per item.** No subscription, OAuth or Residential. You only pay for the data you scrape, and new Apify accounts include free monthly credits so you can test it for **$0**.

### 🔎 What can it extract?
- Post: title, score, upvote ratio, awards
- **Full nested comment trees** (replies)
- Author, subreddit, flair, NSFW/stickied
- Media (gallery, video), markdown + token counts
- Modes: subreddit, post, user, search

### 🚀 How do I use it?
1. Click **Try for free**.
2. Set the input (see example below).
3. Click **Start** and download results as JSON, CSV or Excel — or pull them via the API / schedule them.

### ⚙️ Input example
```json
{
  "mode": "subreddit",
  "subreddit": "python",
  "sort": "top",
  "maxPosts": 50,
  "includeComments": true
}
````

### 📦 Output example

```json
{
  "title": "\u2026",
  "score": 4200,
  "upvote_ratio": 0.98,
  "num_comments": 351,
  "comments": [
    {
      "author": "\u2026",
      "body": "\u2026",
      "replies": []
    }
  ]
}
```

### 🎯 Use cases

- Sentiment & community research
- AI / RAG over discussions
- Brand & topic monitoring
- Lead/market research

### 💰 How much will it cost?

You pay only the per-result price (with a free Reddit app):
100 → ~$0.1 · 1,000 → ~$1 · 10,000 → ~$10

### 🆚 Why this one

| Feature | This actor | Others |
|---|---|---|
| Full comment trees | ✅ | top-level only |
| AI markdown + tokens | ✅ | ❌ |
| OAuth = free, no proxy | ✅ | proxy only |

### 🔗 Related actors

- [Hacker News Scraper](https://apify.com/ninhothedev/hacker-news-scraper) — tech discussions
- [Google News Scraper](https://apify.com/ninhothedev/google-news-scraper) — news
- [Devto Scraper](https://apify.com/ninhothedev/devto-scraper) — dev articles
- [Instagram Scraper](https://apify.com/ninhothedev/instagram-scraper) — social

### ❓ FAQ

**Credentials?** Reddit blocks datacenter IPs — add a free Reddit app's Client ID/Secret (OAuth) for fast, proxy-free scraping, or use a residential proxy.

### 🛟 Support

Found a bug or need an extra field? Open an issue on the actor — fixes and new fields ship fast.

### Legal & privacy

Public Reddit content. Respect Reddit's API terms.

***

**Keywords:** reddit scraper, posts, comments, subreddit, sentiment, AI training, social media, JSON CSV Excel

# Actor input Schema

## `mode` (type: `string`):

What to scrape: subreddit posts, specific posts (with full comments), a user's posts, or search results.

## `subreddit` (type: `string`):

Subreddit name without r/ (e.g. 'python'). Used by subreddit mode, and to restrict search.

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

Sort order for posts (hot/new/top/rising/controversial; for search: relevance/top/new/comments).

## `timeFilter` (type: `string`):

Time window for 'top'/'controversial'/search sorts.

## `postUrls` (type: `array`):

Reddit post URLs to scrape with their full comment trees (mode = post).

## `username` (type: `string`):

Reddit username without u/ (mode = user).

## `searchQuery` (type: `string`):

Search keywords (mode = search). Combine with 'subreddit' to restrict.

## `maxPosts` (type: `integer`):

Maximum posts to scrape per run (paginated automatically).

## `includeComments` (type: `boolean`):

Also fetch the full nested comment tree for each post (post mode always includes them).

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

Cap the number of comments fetched per post (across the whole tree).

## `maxCommentDepth` (type: `integer`):

How deep to follow nested replies (1 = top-level only).

## `commentSort` (type: `string`):

How to sort comments.

## `clientId` (type: `string`):

From a free Reddit app (reddit.com/prefs/apps → create app → type 'script' or 'web'). Enables the fast OAuth API with NO proxy. Leave empty to use the .json fallback (needs a residential proxy).

## `clientSecret` (type: `string`):

The secret of your Reddit app.

## `userAgent` (type: `string`):

Optional custom User-Agent (Reddit recommends a unique one, e.g. 'web:myapp:1.0 (by /u/me)').

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

Only used for the .json fallback (no OAuth credentials). Use RESIDENTIAL — Reddit blocks datacenter IPs. Not needed when Client ID/Secret are set.

## Actor input object example

```json
{
  "mode": "subreddit",
  "subreddit": "python",
  "sort": "hot",
  "timeFilter": "all",
  "postUrls": [],
  "maxPosts": 50,
  "includeComments": false,
  "maxComments": 200,
  "maxCommentDepth": 10,
  "commentSort": "top",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `posts` (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 = {
    "subreddit": "python",
    "maxPosts": 50,
    "maxComments": 200,
    "maxCommentDepth": 10,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/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 = {
    "subreddit": "python",
    "maxPosts": 50,
    "maxComments": 200,
    "maxCommentDepth": 10,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/reddit-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 '{
  "subreddit": "python",
  "maxPosts": 50,
  "maxComments": 200,
  "maxCommentDepth": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call ninhothedev/reddit-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Scraper – Posts, Full Comment Trees & Users",
        "description": "$1.5/1K 🔥 Fast Reddit scraper! Posts, comments, scores, authors & full comment trees from any subreddit or search. JSON, CSV, Excel or API in seconds. Paste a subreddit or keyword & pull thousands of posts for research & trend-tracking ⚡",
        "version": "1.0",
        "x-build-id": "5FuisvvqD1CikwjeA"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ninhothedev~reddit-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ninhothedev-reddit-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/ninhothedev~reddit-scraper/runs": {
            "post": {
                "operationId": "runs-sync-ninhothedev-reddit-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/ninhothedev~reddit-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-ninhothedev-reddit-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",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "subreddit",
                            "post",
                            "user",
                            "search"
                        ],
                        "type": "string",
                        "description": "What to scrape: subreddit posts, specific posts (with full comments), a user's posts, or search results.",
                        "default": "subreddit"
                    },
                    "subreddit": {
                        "title": "Subreddit",
                        "type": "string",
                        "description": "Subreddit name without r/ (e.g. 'python'). Used by subreddit mode, and to restrict search."
                    },
                    "sort": {
                        "title": "Sort",
                        "enum": [
                            "hot",
                            "new",
                            "top",
                            "rising",
                            "controversial",
                            "relevance"
                        ],
                        "type": "string",
                        "description": "Sort order for posts (hot/new/top/rising/controversial; for search: relevance/top/new/comments).",
                        "default": "hot"
                    },
                    "timeFilter": {
                        "title": "Time filter",
                        "enum": [
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year",
                            "all"
                        ],
                        "type": "string",
                        "description": "Time window for 'top'/'controversial'/search sorts.",
                        "default": "all"
                    },
                    "postUrls": {
                        "title": "Post URLs",
                        "type": "array",
                        "description": "Reddit post URLs to scrape with their full comment trees (mode = post).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "username": {
                        "title": "Username",
                        "type": "string",
                        "description": "Reddit username without u/ (mode = user)."
                    },
                    "searchQuery": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Search keywords (mode = search). Combine with 'subreddit' to restrict."
                    },
                    "maxPosts": {
                        "title": "Max posts",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum posts to scrape per run (paginated automatically).",
                        "default": 50
                    },
                    "includeComments": {
                        "title": "Include comments",
                        "type": "boolean",
                        "description": "Also fetch the full nested comment tree for each post (post mode always includes them).",
                        "default": false
                    },
                    "maxComments": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Cap the number of comments fetched per post (across the whole tree).",
                        "default": 200
                    },
                    "maxCommentDepth": {
                        "title": "Max comment depth",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "How deep to follow nested replies (1 = top-level only).",
                        "default": 10
                    },
                    "commentSort": {
                        "title": "Comment sort",
                        "enum": [
                            "top",
                            "best",
                            "new",
                            "controversial",
                            "old",
                            "qa"
                        ],
                        "type": "string",
                        "description": "How to sort comments.",
                        "default": "top"
                    },
                    "clientId": {
                        "title": "Reddit Client ID (recommended)",
                        "type": "string",
                        "description": "From a free Reddit app (reddit.com/prefs/apps → create app → type 'script' or 'web'). Enables the fast OAuth API with NO proxy. Leave empty to use the .json fallback (needs a residential proxy)."
                    },
                    "clientSecret": {
                        "title": "Reddit Client Secret",
                        "type": "string",
                        "description": "The secret of your Reddit app."
                    },
                    "userAgent": {
                        "title": "User agent",
                        "type": "string",
                        "description": "Optional custom User-Agent (Reddit recommends a unique one, e.g. 'web:myapp:1.0 (by /u/me)')."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Only used for the .json fallback (no OAuth credentials). Use RESIDENTIAL — Reddit blocks datacenter IPs. Not needed when Client ID/Secret are set.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
