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

Collect Reddit posts, comments and search results.

- **URL**: https://apify.com/barefoot_grade/reddit-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/barefoot_grade) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.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/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

Turn subreddits, user profiles, Reddit searches and comment threads into clean, structured rows. Every post comes with its title, author, subreddit, posting time, link, text, thumbnail, **exact upvote count** and **exact comment count**, and every comment with its author, text, time and link. No Reddit account or login is needed.

Pick Hot, New, Top, Rising or Controversial with a time window, read up to 1,000 posts per subreddit, user or search, and add the comment threads (up to 500 comments per post) when you need the conversation too. A total row cap keeps big lists from running away. Sources that cannot be read are listed in the run summary and are not charged.

### Use cases

- **Brand and product monitoring**: every new post and comment that mentions your product, with its exact upvotes.
- **Market and audience research**: what a community talks about this week, ranked by Top or Hot.
- **Trend tracking**: re-run the same subreddits and searches on a schedule and compare scores over time.
- **Content and topic ideas**: the questions people ask in a niche, with the full post text.
- **Sentiment and AI datasets**: full comment threads as clean text, one row per comment.

### Quick Start

```json
{
  "startUrls": ["r/python", "r/datascience"],
  "sort": "hot",
  "maxPostsPerSource": 25,
  "maxItems": 100
}
```

Each subreddit gives its posts in the order Reddit shows them. Add `searchQueries` to search all of Reddit, or paste a post link to get the post with its comments.

### Input

| Input | Type | Default | Meaning |
| --- | --- | --- | --- |
| `startUrls` | array | — | One per line: a subreddit (`r/python` or `https://www.reddit.com/r/python/`), a user (`u/name` or a profile link), a post link (its comments are included) or a Reddit search link. A sort in a subreddit link, such as `https://www.reddit.com/r/python/top/?t=month`, is respected. |
| `searchQueries` | array | — | Searches across all of Reddit, one per line. Add `subreddit:name` to search inside one community. |
| `sort` | string | `hot` | Order of subreddit and user posts: `hot`, `new`, `top`, `rising` or `controversial`. |
| `timeFilter` | string | `week` | For Top, Controversial and searches: `hour`, `day`, `week`, `month`, `year` or `all`. |
| `searchSort` | string | `relevance` | Order of search results: `relevance`, `hot`, `top`, `new` or `comments`. |
| `maxPostsPerSource` | integer | `100` | Posts per subreddit, user or search, 1 to 1,000. Reddit lists at most about 1,000 posts per listing. |
| `includeScores` | boolean | `true` | Exact upvotes, comment count, NSFW flag and post type for every post. Turn off for faster runs when you only need the posts. |
| `includeComments` | boolean | `false` | Also collect the comment thread of each post found in subreddits, users and searches. Post links always include their comments. |
| `maxCommentsPerPost` | integer | `100` | Comments per post, 1 to 500, in Reddit's default thread order. |
| `maxItems` | integer | `1000` | Total cap on rows (posts plus comments) across every source, up to 100,000. |

Give at least one start link or search.

### Example queries

- `{"startUrls": ["r/MachineLearning"], "sort": "top", "timeFilter": "month", "maxPostsPerSource": 200}`
- `{"searchQueries": ["home espresso machine"], "searchSort": "new", "timeFilter": "week"}`
- `{"searchQueries": ["subreddit:personalfinance emergency fund"], "searchSort": "top", "timeFilter": "year"}`
- `{"startUrls": ["https://www.reddit.com/r/coolguides/comments/1x4u7iw/"], "maxCommentsPerPost": 500}`
- `{"startUrls": ["r/startups/new/"], "includeComments": true, "maxPostsPerSource": 20, "maxCommentsPerPost": 50}`
- `{"startUrls": ["u/spez"], "sort": "new"}`

### What it returns

The dataset has one row per post and one row per comment. The `type` field tells them apart.

Posts (`"type": "post"`):

| Field | Meaning |
| --- | --- |
| `id` | Reddit's post id, such as `1x9wrks`. |
| `title` | The post title. |
| `author` | Username without `u/`; `null` for deleted accounts. |
| `subreddit` | Community name without `r/`. Profile posts show as `u_<name>`. |
| `createdAt` | When it was posted (UTC, ISO 8601). |
| `url` | Where the post points: the article, image or video for link posts, the post itself for text posts. |
| `permalink` | The post's page on Reddit. |
| `domain` | The linked site, or `self.<subreddit>` for text posts. |
| `isSelf` | `true` for text posts. |
| `selftext` | The post body as plain text (empty for link posts). |
| `thumbnail` | Preview image link, when Reddit has one. |
| `upvotes` | Exact upvote score. |
| `commentCount` | Exact number of comments. |
| `nsfw` | Whether the post is marked NSFW. |
| `postType` | `text`, `link`, `image`, `gallery`, `video`, `crosspost` or `multi_media`. |
| `source` | The input line the row came from. |
| `scrapedAt` | Collection time (UTC, ISO 8601). |

`upvotes`, `commentCount`, `nsfw` and `postType` are `null` when `includeScores` is off, or for the rare post whose counts could not be read (the post itself is still delivered).

Comments (`"type": "comment"`): `id`, `postId`, `postTitle`, `author`, `subreddit`, `createdAt`, `permalink`, `body` (plain text), `source` and `scrapedAt`.

The run summary (`OUTPUT`) reports `posts`, `comments`, `postsWithScores`, and any source that could not be read in `sourceErrors`, each with a short code and message (for example `NOT_FOUND` for a banned or misspelled subreddit, `FORBIDDEN` for a private one, or `BLOCKED`).

### Output example

```jsonl
{"type": "post", "id": "1x9wrks", "title": "US delaying Patriot missiles already paid for under NATO initiative, Zelensky says", "author": "T_Shurt", "subreddit": "worldnews", "createdAt": "2026-10-19T13:22:47Z", "url": "https://kyivindependent.com/us-delaying-patriot-missiles-already-paid-for-under-nato-initiative-zelensky-says/", "permalink": "https://www.reddit.com/r/worldnews/comments/1x9wrks/us_delaying_patriot_missiles_already_paid_for/", "domain": "kyivindependent.com", "isSelf": false, "selftext": "", "thumbnail": "https://external-preview.redd.it/gSCmBe2rVmyL5oHEZB75VkW8M_e2fbtg2kGfLk_lY5I.jpeg?width=640&crop=smart&auto=webp&s=9aa23667e53366c52e98b2b01a03ee9449bff356", "upvotes": 15457, "commentCount": 626, "nsfw": false, "postType": "link", "source": "r/worldnews", "scrapedAt": "2026-10-20T01:32:29.163Z"}
{"type": "post", "id": "1x5tqz7", "title": "Which grinder is best for home espresso machine. Is DF 54 good [INR 30000]", "author": "aashishsocial", "subreddit": "espresso", "createdAt": "2026-10-14T15:09:27Z", "url": "https://www.reddit.com/r/espresso/comments/1x5tqz7/which_grinder_is_best_for_home_espresso_machine/", "permalink": "https://www.reddit.com/r/espresso/comments/1x5tqz7/which_grinder_is_best_for_home_espresso_machine/", "domain": "self.espresso", "isSelf": true, "selftext": "Which grinder is best for home espresso machine. Is DF 54 good [INR 30000] which is roughly 300 USD.\n\ni have been looking at df 54 and df 54 v4. I am based in India", "thumbnail": null, "upvotes": 2, "commentCount": 4, "nsfw": false, "postType": "text", "source": "home espresso machine", "scrapedAt": "2026-10-20T01:32:08.585Z"}
{"type": "comment", "id": "pgguzw1", "postId": "1x4u7iw", "postTitle": "A cool guide on how to spot some common styles of bots on Reddit (by me)", "author": "luisduck", "subreddit": "coolguides", "createdAt": "2026-10-13T12:24:30Z", "permalink": "https://www.reddit.com/r/coolguides/comments/1x4u7iw/a_cool_guide_on_how_to_spot_some_common_styles_of/pgguzw1/", "body": "The writing style to me is not distinctive enough to pick up on. Either I'm stupid or this is just like some people wrote even before AI.", "source": "https://www.reddit.com/r/coolguides/comments/1x4u7iw/a/", "scrapedAt": "2026-10-20T01:44:24.908Z"}
```

### How fast

Reddit limits how quickly anyone can read it, and the actor stays within those limits. As a guide: about **250 posts a minute with exact upvotes and comment counts**, about **800 posts a minute with `includeScores` off** (a full 1,000-post subreddit listing in under 2 minutes), and about **15 to 20 comment threads a minute** when comments are included. A subreddit's first 100 posts with scores usually arrive in under a minute.

### Price

**$0.001 per row** delivered (one post or one comment), plus **$0.005 per run start**. The run-start event is charged per GB of memory; the default 512 MB run is one start event. The start is charged even if the run saves no results. Sources that could not be read are not charged. Platform usage is included in these prices.

### Good to know

- Post flair, awards, upvote ratio and per-comment scores are not included. Comments come in Reddit's thread order without a reply-to field.
- Reddit shows at most about 1,000 posts for any one listing or search, and some sorts (Rising, Top of the past hour) list far fewer.
- Upvote counts are a snapshot at collection time; Reddit itself slightly fuzzes scores on very new posts.
- Private, quarantined and banned communities cannot be read; they are reported in `OUTPUT.sourceErrors` and are not charged.
- If Reddit temporarily refuses requests, the run retries with growing pauses. Rows already collected are kept. If nothing at all can be read, the run fails with a clear message.

# Actor input Schema

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

One per line: a subreddit (r/python or a reddit.com/r/... link), a user (u/name or a reddit.com/user/... link), a post link (its comments are collected too) or a Reddit search link.

## `searchQueries` (type: `array`):

Searches across all of Reddit, one per line, exactly as you would type them into Reddit's search box. Tip: add subreddit:name to search inside one community.

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

Hot, New, Top, Rising or Controversial. A sort inside a subreddit link (reddit.com/r/name/top) takes precedence.

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

For Top and Controversial sorting and for searches: past hour, day, week, month, year or all time.

## `searchSort` (type: `string`):

Relevance, Hot, Top, New or Most comments.

## `maxPostsPerSource` (type: `integer`):

How many posts to collect from each source. Reddit lists at most about 1,000 posts per listing.

## `includeScores` (type: `boolean`):

Add each post's exact upvote count, comment count, NSFW flag and post type. Turn off for faster runs when you only need the posts themselves.

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

Also collect the comment thread of each post found in subreddits, users and searches. Post links always include their comments. Each comment is one row.

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

Up to 500 comments per post, in Reddit's default thread order.

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

Total cap on posts plus comments across every source. The run stops when it is reached.

## Actor input object example

```json
{
  "startUrls": [
    "r/python",
    "r/datascience"
  ],
  "sort": "hot",
  "timeFilter": "week",
  "searchSort": "relevance",
  "maxPostsPerSource": 25,
  "includeScores": true,
  "includeComments": false,
  "maxCommentsPerPost": 100,
  "maxItems": 100
}
```

# Actor output Schema

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

No description

## `summary` (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": [
        "r/python",
        "r/datascience"
    ],
    "sort": "hot",
    "maxPostsPerSource": 25,
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("barefoot_grade/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": [
        "r/python",
        "r/datascience",
    ],
    "sort": "hot",
    "maxPostsPerSource": 25,
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("barefoot_grade/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": [
    "r/python",
    "r/datascience"
  ],
  "sort": "hot",
  "maxPostsPerSource": 25,
  "maxItems": 100
}' |
apify call barefoot_grade/reddit-scraper --silent --output-dataset

```

## MCP server setup

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