# Reddit Scraper: Posts, Comments & Search (`wiseus-labs/reddit-scraper`) Actor

Scrape Reddit posts and comments from subreddits, users, search and post links in one run. Get title, text, score, comment count, flair, author, media and deep reply threads. Date range, minimum score and only-new mode. No login or API key. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/wiseus-labs/reddit-scraper.md
- **Developed by:** [Wiseus Labs](https://apify.com/wiseus-labs) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

<a href="https://console.apify.com/actors/GjbVOaDIP9GDaiEJo/input"><img width="840" alt="Reddit Scraper: posts, comments and search to CSV, JSON, Excel" src="https://api.apify.com/v2/key-value-stores/YWwrfVoUzvcZJtP7f/records/reddit-scraper-hero-v2.jpg"></a>

<blockquote style="border-left:4px solid #FF4500;background:#FFF1EC;padding:10px 16px;margin:0"><span style="font-size:15px;font-weight:700;color:#1C1917">Reddit posts and comments from subreddits, users, search and post links</span><span style="font-size:15px;color:#57534E">: text, score, comment count, author, flair and media in one table, one row per item, exported to JSON, CSV or Excel. Also: long reply chains with depth and parent, an only-new mode that skips what earlier runs returned, pinned posts skipped on request, and a failed run status when no input could be read, so your schedule notices.</span></blockquote>

#### Copy to your AI assistant

```text
Help me use wiseus-labs/reddit-scraper, an Apify Actor that scrapes Reddit posts and comments from subreddits, users, search terms and post links. Read https://apify.com/wiseus-labs/reddit-scraper.md for documentation and the input schema. Choose settings for my requested outcome. If you cannot open the page, ask me to paste the relevant sections.
```

Key inputs: `startUrls` (subreddits, users, posts, search pages; `r/name` and `u/name` work too), `searchQueries` (keywords), `sort` and `timeFilter`, `maxPostsPerSource` (default 25), `includeComments`, `dateFrom`, `onlyNew`.

### 🔶 What is Reddit Scraper?

Reddit Scraper turns subreddits, user pages, search terms and post links into clean rows of posts and comments, ready for CSV, Excel, JSON or your own code.

- **Links and keyword searches in one run:** subreddits, users, posts and search pages in any common link form, plus search terms.
- **Posts and comments in one table** with a `recordType` column; each comment carries its post title, depth and parent.
- **Only new items** for scheduled runs: posts and comments that earlier runs returned are skipped and not charged.
- **Filters** by date window, minimum score and NSFW, and pinned posts skipped on request.
- **Clear run status:** a run where no input could be read ends as failed, so schedules and webhooks notice it.
- **No Reddit login, no API key, no cookies.**

| Group | What you get |
|---|---|
| 📝 **Post** | 🔖 title and text · 🔗 link and domain · 🗂️ subreddit and subreddit ID · 🏷️ flair · 🧭 post type (text, link, image, gallery, video) · 🔢 rank in the feed or search |
| 💬 **Comment** | 🧵 comment text · 🪜 depth and parent comment · 📄 post ID, post link and post title · ✍️ edited time · 📌 pinned by moderators · 🙋 written by the post author |
| 👤 **Author** | 🪪 author name and author ID (t2\_) · 🎖️ author flair on posts |
| 📈 **Engagement** | ⬆️ score · 📊 upvote ratio · 💭 comment count · 🔞 NSFW, spoiler, locked and pinned flags |
| 🖼️ **Media** | 🖼️ image links, gallery images included · 🎬 video link · 🧩 thumbnail |
| 🕒 **Context** | 📅 ISO 8601 UTC dates · 🔑 search term · 📍 the input each row came from · ⏱️ scraped time |

### 🚀 Quick start

<p align="center"><a href="https://console.apify.com/actors/GjbVOaDIP9GDaiEJo/input"><img width="840" alt="Step 1: enter subreddits, posts, users or keywords" src="https://api.apify.com/v2/key-value-stores/YWwrfVoUzvcZJtP7f/records/reddit-scraper-step1-v2.jpg"></a></p>

<p align="center"><a href="https://console.apify.com/actors/GjbVOaDIP9GDaiEJo/input"><img width="840" alt="Step 2: click Start or run it from your code" src="https://api.apify.com/v2/key-value-stores/YWwrfVoUzvcZJtP7f/records/reddit-scraper-step2-v1.jpg"></a></p>

<p align="center"><a href="https://console.apify.com/actors/GjbVOaDIP9GDaiEJo/input"><img width="840" alt="Step 3: get a clean table of Reddit posts and comments" src="https://api.apify.com/v2/key-value-stores/YWwrfVoUzvcZJtP7f/records/reddit-scraper-step3-v2.jpg"></a></p>

1. Add Reddit links, search terms, or both in Step 1 of the form.
2. Click **Start**, or run it from your code or an AI agent.
3. Open the table and download it as JSON, CSV or Excel.

With an empty input the scraper reads an example subreddit (r/space), so you can see the output right away.

### 🍳 How to scrape Reddit: input recipes

#### 1. Brand and keyword monitoring

New posts that mention your brand in the last day, each post only once across scheduled runs.

```json
{
  "searchQueries": ["your brand", "your brand alternative"],
  "sort": "new",
  "dateFrom": "1 day",
  "maxPostsPerSource": 100,
  "onlyNew": true
}
```

#### 2. Top posts of the week to CSV

What a community liked most this week, for market and sentiment research.

```json
{
  "startUrls": ["https://www.reddit.com/r/space/"],
  "sort": "top",
  "timeFilter": "week",
  "maxPostsPerSource": 100
}
```

#### 3. One post with its comments

The comments Reddit shows publicly, including collapsed and "continue this thread" replies, for a discussion dataset.

```json
{
  "startUrls": ["https://www.reddit.com/r/space/comments/1xzbpbk/history_has_been_made_at_this_exact_second/"],
  "includeComments": true,
  "maxCommentsPerPost": 0,
  "maxCommentDepth": 0
}
```

#### 4. Keyword search inside one subreddit

```json
{
  "searchQueries": ["rocket launch"],
  "searchSubreddit": "space",
  "sort": "top",
  "timeFilter": "month",
  "maxPostsPerSource": 50
}
```

#### 5. A user's posts and comments

```json
{
  "startUrls": ["https://www.reddit.com/user/USERNAME/"],
  "maxPostsPerSource": 50
}
```

#### 6. Daily new posts from several subreddits

Run it every day on a schedule: each run saves only posts from the last day that earlier runs did not return, and skips pinned posts.

```json
{
  "startUrls": ["r/space", "r/astronomy", "r/askscience"],
  "sort": "new",
  "dateFrom": "1 day",
  "maxPostsPerSource": 100,
  "skipPinned": true,
  "onlyNew": true
}
```

### ⚙️ Input

The form has five steps. Step 1 is enough to start; comments, filters, monitoring and limits have sensible defaults.

| Field | What it does | Default |
|---|---|---|
| `startUrls` | Subreddits, users, posts and search pages. Any common Reddit link form works, and so do `r/name` and `u/name`. | r/space |
| `searchQueries` | Keywords, one search each. | none |
| `searchSubreddit` | Search inside one subreddit only. | all of Reddit |
| `sort` | `hot`, `new`, `top`, `rising` (subreddits), `relevance`, `comments` (searches). A sort that does not fit an input falls back to that input's usual order. | `hot` |
| `timeFilter` | Time range for Top and for searches: hour, day, week, month, year, all. | `all` |
| `maxPostsPerSource` | Posts per link or search term (comments for a user's comments page). Applies to every input of the run. | 25 |
| `includeComments` | Also save the comments of each saved post. | off |
| `maxCommentsPerPost` | Comments per post. `0` means no limit. | 100 |
| `maxCommentDepth` | `1` top-level comments only, `2` plus direct replies, `0` no depth limit. | 0 |
| `dateFrom`, `dateTo` | Only items created in this window. Exact dates or relative, such as `7 days`. | none |
| `minScore` | Only items with at least this score. | none |
| `includeNsfw` | Include NSFW posts and their comments. | on |
| `skipPinned` | Skip posts pinned by moderators in subreddit feeds. Skipped pinned posts are free and do not count toward Max posts per input. | off |
| `onlyNew` | Skip items that earlier runs with the same inputs already returned. Max posts per input counts the posts checked, so a run returns only the new posts among the latest N. | off |
| `maxItems` | Stop after this many posts and comments in total. `0` means no limit. | 0 |

Every field is explained in the **Input** tab.

### 📦 Output example

One post and one comment from runs on r/space. Trimmed for length: the post text is cut and its image list is shortened to one link.

```json
{
  "recordType": "post",
  "id": "1xztdwk",
  "fullname": "t3_1xztdwk",
  "url": "https://www.reddit.com/r/space/comments/1xztdwk/ama_were_astronauts_anil_menon_aboard_the/",
  "title": "AMA: We're astronauts Anil Menon (aboard the International Space Station) and Zena Cardman. Ask us about how to become an astronaut!",
  "text": "[NASA astronaut Anil Menon](https://www.nasa.gov/people/nasa-astronaut-anil-menon/) has been living and working aboard the International Space Station since Jul...",
  "linkUrl": null,
  "domain": "self.space",
  "subreddit": "space",
  "subredditId": "t5_2qh87",
  "authorName": "nasa",
  "authorId": "t2_1dkvvygb",
  "authorFlair": "NASA Official",
  "createdAt": "2026-11-18T22:52:58Z",
  "editedAt": "2026-11-19T18:13:32Z",
  "score": 478,
  "upvoteRatio": 0.96,
  "numComments": 174,
  "flair": "Official AMA",
  "isNsfw": false,
  "isSpoiler": false,
  "isLocked": true,
  "isStickied": true,
  "isVideo": false,
  "postType": "text",
  "thumbnail": null,
  "imageUrls": [
    "https://external-preview.redd.it/GFBGKzEDonVNXmUMKXVAS5dE1Npfq3w18W5au2_pK4A.jpeg?auto=webp&s=39eca5d91211022b31ab658d3b304c7e287f87d4"
  ],
  "videoUrl": null,
  "searchQuery": null,
  "rank": 1,
  "inputSource": "https://www.reddit.com/r/space/",
  "sourceType": "subreddit",
  "scrapedAt": "2026-11-20T11:18:55Z"
}
```

```json
{
  "recordType": "comment",
  "id": "19svpqpjsfzpg",
  "fullname": "t1_19svpqpjsfzpg",
  "url": "https://www.reddit.com/r/space/comments/1xztdwk/comment/19svpqpjsfzpg/",
  "text": "There are no age restrictions to apply to become an astronaut. The youngest ever selected was 26. The oldest was 46. -TA",
  "postId": "1xztdwk",
  "postUrl": "https://www.reddit.com/r/space/comments/1xztdwk/ama_were_astronauts_anil_menon_aboard_the/",
  "postTitle": "AMA: We're astronauts Anil Menon (aboard the International Space Station) and Zena Cardman. Ask us about how to become an astronaut!",
  "parentId": "t1_19sufkn2g7ngk",
  "depth": 1,
  "subreddit": "space",
  "subredditId": "t5_2qh87",
  "authorName": "nasa",
  "authorId": "t2_1dkvvygb",
  "createdAt": "2026-11-19T17:02:53Z",
  "editedAt": null,
  "score": 1,
  "isStickied": false,
  "isSubmitter": true,
  "searchQuery": null,
  "rank": 135,
  "inputSource": "https://www.reddit.com/r/space/new/",
  "sourceType": "subreddit",
  "scrapedAt": "2026-11-20T11:21:58Z"
}
```

### 📋 Output fields

- **All rows:** `recordType` (`post`, `comment` or `status`), `id`, `fullname`, `url`, `inputSource`, `sourceType`, `searchQuery`, `rank`, `scrapedAt`
- **Post:** `title`, `text`, `linkUrl`, `domain`, `subreddit`, `subredditId`, `authorName`, `authorId`, `authorFlair`, `createdAt`, `editedAt`, `score`, `upvoteRatio`, `numComments`, `flair`, `isNsfw`, `isSpoiler`, `isLocked`, `isStickied`, `isVideo`, `postType`, `thumbnail`, `imageUrls`, `videoUrl`
- **Comment:** `text`, `postId`, `postUrl`, `postTitle`, `parentId`, `depth`, `subreddit`, `subredditId`, `authorName`, `authorId`, `createdAt`, `editedAt`, `score`, `isStickied`, `isSubmitter`
- **Status rows:** `status`, `reason`, `id`, `url`, `inputSource`, `sourceType`, `searchQuery`, `scrapedAt`

| `status` | Meaning | Charged |
|---|---|---|
| `not_found` | The subreddit, user or post does not exist or was removed | Free |
| `private` | The subreddit or user page is private | Free |
| `banned` | The subreddit or user is banned | Free |
| `no_results` | The input (with your filters) returned nothing | Free |
| `error` | The input could not be read or loaded | Free |
| `run_summary` | Nothing was saved; the row says why | Free |

`depth` starts at 0 for top-level comments of a post. `parentId` is empty for top-level comments and holds the parent comment's `fullname` for replies. Comments read from a user's page have no `depth`, and their `parentId` is the `fullname` of the comment or post they answer.

The Output tab also has a **Run summary**: posts and comments saved per input, duplicates skipped, items skipped by filters and by Only new items, failed inputs, and the comment coverage per post (comments found compared with the number Reddit lists for the post).

#### What you don't pay for

- Inputs that are not found, private, banned or without results: they get free status rows with a reason.
- Items outside your filters (dates, minimum score, NSFW off) and pinned posts skipped with Skip pinned posts.
- Duplicates: a post or comment found by two inputs is saved and charged once.
- Items skipped by Only new items because an earlier run already returned them.
- The run summary.

### ⏰ Scheduling and monitoring

Use a [schedule](https://docs.apify.com/platform/schedules) to run the same input every hour or every day, and turn on **Only new items**:

- Posts and comments that earlier runs with the same input returned are skipped and not charged.
- Max posts per input counts the posts checked, so a run returns only the new posts among the latest N.
- Comments of a post returned before are read again only when the post has new comments.
- When strict filters match almost nothing, reading an input stops after checking 5 times Max posts per input (at least 100 posts), so a quiet day stays a small run.
- If no input could be read, the run ends as failed and your schedule or webhook notices it; if only some failed, the status message says how many, for example "2 of 5 inputs failed".

The scraper remembers what it returned in a key-value store of your account named `reddit-scraper-only-new`, separately for each input. Add `dateFrom` such as `1 day` to keep each run small.

### 🔌 API and integrations

Get posts in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/wiseus-labs~reddit-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://www.reddit.com/r/space/"], "sort": "top", "timeFilter": "week", "maxPostsPerSource": 50}'
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("wiseus-labs/reddit-scraper").call(
    run_input={"searchQueries": ["your brand"], "sort": "new", "dateFrom": "1 day", "maxPostsPerSource": 100}
)
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    if row.get("recordType") in ("post", "comment"):
        print(row["recordType"], row["createdAt"], row["score"], row.get("title"))
```

- **Webhooks:** get notified when a run finishes. See [webhooks](https://docs.apify.com/platform/integrations/webhooks).
- **Make, Zapier, n8n:** use the Apify app or node and pick this Actor to send new rows to Google Sheets, Slack, a database or a CRM. See [integrations](https://docs.apify.com/platform/integrations).
- **API reference:** the **API** tab on this page shows ready code for every language.

#### Use with AI agents (MCP)

Connect the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) to Claude, Cursor or another AI assistant and add this Actor. Then ask in plain words, for example: "Find Reddit posts from the last week that ask for an alternative to our product and summarize the main complaints."

### ❓ FAQ

**Do I need a Reddit login, an API key or cookies?**
No. You don't log in to Reddit, you don't need a Reddit API key, and there is nothing to set up.

**How do I get only new posts?**
Turn on Only new items and run the same input on a schedule. Posts and comments that earlier runs returned are skipped and not charged. See **Scheduling and monitoring** above.

**Does it get replies to comments?**
Yes. Replies are saved as their own rows with `depth` and `parentId`, including collapsed replies and "continue this thread" links. Use `maxCommentDepth` to stop at a level, for example 1 for top-level comments only.

**What happens if Reddit does not let the scraper read an input?**
That input gets a free status row with the reason. If no input of the run could be read, the run ends as failed. Inputs that do not exist or are private or banned are an answer, not a failure.

**How do I sort and limit search results by date?**
Search terms accept `sort` (relevance, hot, new, top, comments) and `timeFilter` (hour to all time). For an exact window use `dateFrom` and `dateTo`. With sort New, reading stops as soon as posts are older than `dateFrom`.

**Can I skip pinned posts and NSFW posts?**
Yes. Turn on Skip pinned posts to leave out moderator pins in subreddit feeds, and turn off Include NSFW to leave out NSFW posts and their comments. Skipped posts are not charged.

**Why does Max posts per input apply to every input?**
It is one value per run. If a subreddit needs 50 posts and a search needs 200, run the scraper twice with two inputs.

**What do the IDs look like?**
Posts have Reddit's own short IDs such as `1xztdwk` (`fullname` `t3_1xztdwk`). Comment IDs are Reddit's own too, 7 or 13 characters long (`fullname` starts with `t1_`). Authors have an `authorId` starting with `t2_`.

**How do I export Reddit data to CSV or Excel?**
After the run, open the **Output** tab and click **Export**. Choose CSV, Excel, JSON or another format. Through the API add `format=csv` to the dataset items link.

### 💬 Feedback and support

Found a bug or missing a field? Open an issue on the **Issues** tab and tell us what you need.

Ready to try it? [Open the input form](https://console.apify.com/actors/GjbVOaDIP9GDaiEJo/input), paste a subreddit or type a keyword and click **Start**.

# Changelog

This Actor's version history is a separate document: https://apify.com/wiseus-labs/reddit-scraper/changelog.md

# Actor input Schema

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

One link per line: a subreddit (reddit.com/r/space, /r/space/new, /r/space/top/?t=week), a user (reddit.com/user/NAME, /u/NAME, /user/NAME/submitted, /user/NAME/comments), a post (any reddit.com post link, comment links, redd.it short links, share links), or a search page (reddit.com/search?q=..., reddit.com/r/NAME/search?q=...). Shortcuts r/NAME and u/NAME work too. A sort or time in the link (/new, ?t=week) is used for that link.

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

Keywords to search Reddit posts for, one per line. Each term is one search; its posts are saved with the term in searchQuery.

## `searchSubreddit` (type: `string`):

Only search inside this subreddit (name without r/, for example space). Empty: search all of Reddit.

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

Order of posts. Subreddits use hot, new, top or rising; users use hot, new or top; searches use relevance, hot, new, top or comments. A sort that does not fit an input falls back to that input's usual order (hot for subreddits, new for users, relevance for searches).

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

Time range for Top and for searches: past hour, day, week, month, year or all time.

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

How many posts to save for each link or search term (for a user's comments page: how many comments). Reddit lists up to about 1000 posts per feed.

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

Also save the comments of each saved post, replies included, each as its own row.

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

How many comments to save for each post. 0 = no limit.

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

How deep into reply threads to go. 1 = top-level comments only, 2 = plus their direct replies, 0 = no depth limit.

## `dateFrom` (type: `string`):

Only posts and comments created at or after this date (UTC), or within a relative period such as 7 days. With sort New, reading stops once the feed is older than this date.

## `dateTo` (type: `string`):

Only posts and comments created at or before this date (UTC; a date without a time includes that whole day).

## `minScore` (type: `integer`):

Only posts and comments with at least this score (upvotes minus downvotes). Empty: no score filter.

## `includeNsfw` (type: `boolean`):

Include posts marked NSFW (18+) and their comments.

## `skipPinned` (type: `boolean`):

Skip posts pinned by moderators in subreddit feeds (rules, weekly threads, announcements). Skipped pinned posts are not charged and do not count toward Max posts per input.

## `onlyNew` (type: `boolean`):

On repeated runs with the same inputs, skip (and do not charge) posts and comments that earlier runs already returned. Earlier results are remembered per input in a key-value store of your account named reddit-scraper-only-new (up to 50,000 per input).

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

Stop after this many posts and comments in total. 0 = no limit.

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

Requests in flight at once. The scraper lowers it on its own when Reddit pushes back.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.reddit.com/r/space/",
    "https://www.reddit.com/r/AskReddit/comments/1y0qv5v/"
  ],
  "searchQueries": [],
  "searchSubreddit": "",
  "sort": "hot",
  "timeFilter": "all",
  "maxPostsPerSource": 10,
  "includeComments": true,
  "maxCommentsPerPost": 20,
  "maxCommentDepth": 0,
  "includeNsfw": true,
  "skipPinned": false,
  "onlyNew": false,
  "maxItems": 0,
  "maxConcurrency": 8
}
```

# Actor output Schema

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

One row per post or comment (recordType), plus a status row for each input that gave no results. Tabs: Overview, Posts, Comments, Authors, Engagement, Media, Status, plus All fields.

## `runSummary` (type: `string`):

Posts and comments saved per input, comment coverage per post, items skipped (duplicates, filters, onlyNew) and failed inputs.

# 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": [
        "https://www.reddit.com/r/space/",
        "https://www.reddit.com/r/AskReddit/comments/1y0qv5v/"
    ],
    "maxPostsPerSource": 10,
    "includeComments": true,
    "maxCommentsPerPost": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("wiseus-labs/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": [
        "https://www.reddit.com/r/space/",
        "https://www.reddit.com/r/AskReddit/comments/1y0qv5v/",
    ],
    "maxPostsPerSource": 10,
    "includeComments": True,
    "maxCommentsPerPost": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("wiseus-labs/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": [
    "https://www.reddit.com/r/space/",
    "https://www.reddit.com/r/AskReddit/comments/1y0qv5v/"
  ],
  "maxPostsPerSource": 10,
  "includeComments": true,
  "maxCommentsPerPost": 20
}' |
apify call wiseus-labs/reddit-scraper --silent --output-dataset

```

## MCP server setup

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