# Reddit Scraper (`lordfloofington/reddit-scraper`) Actor

Scrape posts and nested comments from subreddit feeds and Reddit post URLs. $2 per 1,000 posts, $3 per 1,000 comments, no per-run minimum.

- **URL**: https://apify.com/lordfloofington/reddit-scraper.md
- **Developed by:** [Daniel G](https://apify.com/lordfloofington) (community)
- **Categories:** Social media
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.70 / 1,000 posts

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

## Reddit Scraper

This Actor scrapes public subreddit feeds ordered by new, hot, top, or rising, individual Reddit posts, and nested comment threads. Results are post records, optionally with comments attached, or a `{post, comments}` record for a post URL; a run report records what happened for each input URL. Pricing is $2 per 1,000 posts and $3 per 1,000 comments, with no per-run minimum.

### What it returns

Each dataset item is one post row. `comments` is present when comments are requested for that post.

#### Post fields

| Name | Type | Meaning |
| --- | --- | --- |
| `id` | string | Reddit fullname, such as `t3_1wzo05i`. |
| `parsedId` | string | Post ID without the `t3_` prefix. |
| `url` | string | Canonical Reddit post URL. |
| `username` | string or null | Post author. |
| `title` | string or null | Post title. |
| `communityName` | string | Community name with `r/` prefix. |
| `parsedCommunityName` | string | Community name without the prefix. |
| `body` | string | Plain-text post body. |
| `html` | string or null | Post body HTML when available. |
| `numberOfComments` | number | Reddit's reported comment count. |
| `upVotes` | number or null | Post score; null for posts requested by direct URL. |
| `isVideo` | boolean | Whether the post is marked as video. |
| `isAd` | boolean | Ad marker; returned posts have `false`. |
| `over18` | boolean | Whether Reddit marks the post NSFW. |
| `createdAt` | string or null | Post creation time in ISO format. |
| `scrapedAt` | string | Time this Actor parsed the post, in ISO format. |
| `dataType` | string | Always `post`. |
| `postType` | string or null | Reddit's post type, such as `text` or `link`. |
| `upvoteRatio` | number or null | Reddit's upvote ratio when available. |
| `linkUrl` | string or null | External link for link posts. |
| `domain` | string or null | Post link domain when available. |
| `authorId` | string or null | Reddit author fullname when available. |
| `communityId` | string or null | Reddit community fullname when available. |
| `spoiler` | boolean | Whether the post is marked spoiler. |
| `comments` | array | Included comments, when requested. |

Each comment object contains `id` (string), `parsedId` (string), `url` (string), `parentId` (string), `username` (string or null), `category` (string), `communityName` (string), `body` (string), `html` (string or null), `createdAt` (string or null), `scrapedAt` (string), `upVotes` (number or null), `numberOfreplies` (number), `depth` (number), `dataType` (string, always `comment`), and `replies` (array of nested comment objects). Replies retain their parent and thread order.

### Input

`startUrls` is required and accepts subreddit or post URLs. Defaults: `sort: "new"`, `time: "all"`, `maxItems: 25`, `skipComments: false`, `fetchPostComments: false`, `maxCommentsPerPost: 25`, `includeNSFW: false`, and `maxConcurrency: 10`. URL sort and time override input fields. `time` applies to `top` and accepts `hour`, `day`, `week`, `month`, `year`, or `all`. Set `skipComments` to return only the post for a post URL.

Newest 50 posts from a subreddit:

```json
{"startUrls":[{"url":"https://www.reddit.com/r/python/new/"}],"maxItems":50}
```

One post with up to 100 comments:

```json
{"startUrls":[{"url":"https://www.reddit.com/r/python/comments/abc123/example_post/"}],"maxItems":100}
```

Several subreddits with comments attached to each feed post:

```json
{"startUrls":[{"url":"https://www.reddit.com/r/python/"},{"url":"https://www.reddit.com/r/programming/"}],"fetchPostComments":true,"maxItems":10,"maxCommentsPerPost":5}
```

`maxItems` applies per start URL: it caps posts for a subreddit and total comments, including replies, for a post URL. With `fetchPostComments`, `maxCommentsPerPost` caps comments on each feed post. Comments are sampled top-level first, then replies, and retain their nested structure.

### Output examples

Feed post row (text shortened):

```json
{"id":"t3_1wzo05i","parsedId":"1wzo05i","url":"https://www.reddit.com/r/lithuania/comments/1wzo05i/…/","username":"gommy4","title":"JUDU yra tragiskas appsas…","communityName":"r/lithuania","parsedCommunityName":"lithuania","body":"informacija neteisinga…","html":"<p>informacija neteisinga…</p>","numberOfComments":0,"upVotes":1,"isVideo":false,"isAd":false,"over18":false,"createdAt":"2026-10-07T05:05:01.300Z","scrapedAt":"2026-10-07T05:06:08.816Z","dataType":"post","postType":"text","upvoteRatio":1,"linkUrl":null,"domain":"self.lithuania","authorId":"t2_hmgc1","communityId":"t5_2qj20","spoiler":false}
```

Feed post with comments: same post fields plus a `comments` array; each entry has the comment fields above. For example: `{"id":"t3_1wu01wd","dataType":"post","comments":[{"id":"t1_pd018hb","parentId":"t3_1wu01wd","body":"Flight-tracking data…","upVotes":1970,"numberOfreplies":0,"depth":0,"dataType":"comment","replies":[]}]}`.

Post URL row has a wrapper with a post object and comments array. A direct-URL post's score is null:

```json
{"post":{"id":"t3_1ww4kzt","parsedId":"1ww4kzt","url":"https://www.reddit.com/r/europe/comments/1ww4kzt/…/","username":"StraightSky7809","title":"If Britain decides to rejoin the EU…","communityName":"r/europe","parsedCommunityName":"europe","body":"","html":null,"numberOfComments":1489,"upVotes":null,"isVideo":false,"isAd":false,"over18":false,"createdAt":"2026-10-02T20:39:35.000Z","scrapedAt":"2026-10-07T05:06:14.884Z","dataType":"post","postType":null,"upvoteRatio":null,"linkUrl":"https://www.independent.co.uk/news/uk/politics/uk-rejoin-eu-germany-brexit-b3060288.html","domain":null,"authorId":null,"communityId":null,"spoiler":false},"comments":[{"id":"t1_pdhj5gm","parsedId":"pdhj5gm","url":"https://www.reddit.com/r/europe/comments/1ww4kzt/comment/pdhj5gm/","parentId":"t3_1ww4kzt","username":"paneuropeanism_","category":"europe","communityName":"r/europe","body":"Only the US and China benefitted from Brexit…","html":"<div>…</div>","createdAt":"2026-10-02T20:42:21.813Z","scrapedAt":"2026-10-07T05:06:14.885Z","upVotes":2092,"numberOfreplies":0,"depth":0,"dataType":"comment","replies":[]}]}
```

### Run report

The key-value store record `TARGETS` contains one report for each supplied URL: `url` and `type` (`subreddit` or `post`), `status`, `items` (posts emitted), `comments` (comments emitted), `pages`, and `message`. `complete` means the requested item cap was reached or the post request completed; `exhausted` means the feed ended before its cap; `empty-or-unavailable` means no posts were found (the subreddit may be missing, banned, or private); `failed` means requests failed after retries; `skipped` means the URL was unsupported. This record distinguishes an empty feed from a failed request.

### Pricing

Each run is charged per event: `post` at $0.002 and `comment` at $0.003 (replies count as comments). Apify platform usage is included, and there is no minimum per run. For example, 50 posts cost $0.10; one post with 10 comments costs $0.032.

### Limits

Runs by users on Apify's free plan are limited to 3 URLs and 20 results per run.

The Actor reads public Reddit content. It does not support keyword search or user profiles. NSFW posts are excluded unless `includeNSFW` is enabled. Very deep reply chains exposed through Reddit's “continue this thread” links are not followed.

### Use via API

Send a JSON input body to the synchronous dataset-items endpoint:

```sh
curl -X POST 'https://api.apify.com/v2/acts/LordFloofington~reddit-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{"startUrls":[{"url":"https://www.reddit.com/r/python/new/"}],"maxItems":50}'
```

Users are responsible for complying with Reddit's terms and applicable law when using this Actor.

# Actor input Schema

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

Subreddit URLs (https://www.reddit.com/r/python/, optionally with /new/, /hot/, /top/?t=week or /rising/) and post URLs (https://www.reddit.com/r/python/comments/abc123/). A sort or time in the URL overrides the fields below. Runs by users on Apify's free plan are limited to 3 URLs and 20 results per run.

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

Order of subreddit posts: new, hot, top or rising.

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

Time window for the top sort: hour, day, week, month, year or all.

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

Per start URL: the number of posts for a subreddit, or the number of comments (top-level and replies together) for a post URL.

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

For post URLs, return only the post without its comments.

## `fetchPostComments` (type: `boolean`):

For subreddits, attach each post's comments to its row.

## `maxCommentsPerPost` (type: `integer`):

With Fetch post comments on: the maximum number of comments per post (top-level comments first, then replies).

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

Include posts marked NSFW (18+).

## `maxConcurrency` (type: `integer`):

Maximum number of parallel requests.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/python/"
    }
  ],
  "sort": "new",
  "time": "all",
  "maxItems": 25,
  "skipComments": false,
  "fetchPostComments": false,
  "maxCommentsPerPost": 25,
  "includeNSFW": false,
  "maxConcurrency": 10
}
```

# Actor output Schema

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

No description

## `overview` (type: `string`):

No description

## `targets` (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 = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/python/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lordfloofington/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/" }] }

# Run the Actor and wait for it to finish
run = client.actor("lordfloofington/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/"
    }
  ]
}' |
apify call lordfloofington/reddit-scraper --silent --output-dataset

```

## MCP server setup

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