# Reddit Comment Scraper (`crawlerbros/reddit-comment-scraper`) Actor

Scrape Reddit Comments from a post on Reddit. Provides comment text, the parent of the thread, score and timestamps.

- **URL**: https://apify.com/crawlerbros/reddit-comment-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 756 total users, 50 monthly users, 92.6% runs succeeded, 9 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 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.
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?

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

## Reddit Comment Scraper

Scrape **complete Reddit comment threads** — every comment and every nested reply, resolved recursively until the whole conversation is captured. Paste one or more post URLs (or a specific comment permalink) and get back structured comment data with author, votes, timestamps, moderation flags, and thread position, optionally alongside the full parent post record. No Reddit API key or login required.

### What this actor does

- **Full thread resolution** — walks top-level comments and every nested reply, including replies hidden behind Reddit's "load more" placeholders
- **6 comment sort modes** — Best, Top, New, Controversial, Old, Q\&A, matching Reddit's own UI
- **Rich filtering** — date windows, reply-depth range, score thresholds, author allow/deny lists, keyword include/exclude, comment length bounds, controversial-only, and more
- **Optional parent post record** — full post metadata (title, score, media, embeds) emitted first when enabled
- **Flexible URL input** — accepts post URLs, comment permalinks, share links, `redd.it` short links, or bare post IDs
- **Empty fields are omitted** — a field only appears on a record when Reddit actually returned a value for it

### Output per comment

- `dataType` — always `"comment"` for these records
- `comment_id` — comment identifier without the `t1_` prefix
- `comment_name` — full comment name in Reddit's format (`t1_...`)
- `post_id`, `post_url`, `post_title` — identifiers and title of the parent post this comment belongs to
- `link_id` — fullname of the parent post (`t3_...`)
- `permalink` — direct link to the comment on reddit.com
- `author` — commenter's username (`[deleted]` if the account was deleted)
- `author_id` — commenter's fullname (`t2_...`); absent when the author is deleted
- `author_is_blocked` — whether the author has blocked the scraper's account
- `author_flair`, `author_flair_css_class`, `author_flair_template_id`, `author_flair_type`, `author_flair_text_color`, `author_flair_background_color`, `author_flair_richtext` — the author's community flair, when they have one
- `author_premium`, `author_patreon_flair` — whether the author has Reddit Premium / a Patreon badge in this community
- `body` — comment text as markdown
- `body_html` — comment text rendered as Reddit HTML
- `score` — net score (upvotes minus downvotes)
- `ups`, `downs` — raw upvote / downvote counts
- `score_hidden` — whether the score is currently hidden by the community
- `controversiality` — `1` when the up/down split is near-even, else `0`
- `subreddit`, `subreddit_prefixed`, `subreddit_id`, `subreddit_type` — the community the comment belongs to
- `created_utc`, `created_at` — when the comment was posted (Unix epoch and ISO-8601)
- `edited`, `edited_at` — whether and when the comment was last edited
- `depth` — nesting level, `0` = top-level comment
- `parent_id` — fullname of the direct parent (`t3_...` for a post, `t1_...` for another comment)
- `parent_kind` — `post` if it's a top-level reply to the post, `comment` if it's a reply to another comment
- `is_op` — whether the commenter is also the post's original author
- `is_stickied` — whether the comment is pinned by moderators
- `is_locked` — whether the comment thread is locked
- `archived` — whether the comment is archived (voting/commenting closed)
- `distinguished` — `moderator` or `admin` when the author posted in an official capacity
- `collapsed` — whether Reddit collapses the comment by default
- `collapsed_reason`, `collapsed_reason_code` — human-readable and machine-readable reason for the collapse
- `collapsed_because_crowd_control` — whether the collapse was caused by crowd control
- `can_gild` — whether the comment could receive legacy awards
- `comment_type` — optional type marker (e.g. `live`); absent on regular comments
- `unrepliable_reason` — why the comment can't be replied to, when that's the case
- `no_follow` — whether the comment is tagged nofollow for search engines
- `send_replies` — whether the author receives reply notifications for this comment
- `gilded` — number of legacy (gold-style) awards received
- `total_awards_received` — total award count
- `awards` — award breakdown (name, count, coin price, icon URL); omitted when there are no awards
- `removed_by_category` — who removed the comment, when removed: `moderator`, `automod_filtered`, `reddit`, `author`/`deleted`
- `crawled_at` — when the actor fetched this record (ISO-8601)
- `source` — `json` (primary Reddit JSON endpoint) or `dom` (browser fallback)

Deleted/removed comments keep their `[deleted]`/`[removed]` markers in `body` so removals stay auditable.

### Output per post

Emitted once per input URL, as the first record of that thread, when `includePost` is enabled.

- `dataType` — always `"post"` for these records
- `post_id`, `post_name` — bare id and full Reddit name (`t3_...`) of the post
- `title` — post title
- `content`, `content_html` — self-post body as markdown / Reddit HTML (text posts only)
- `content_url` — external destination URL for link posts
- `url`, `permalink` — canonical reddit.com link to the post
- `url_overridden_by_dest` — Reddit's resolved destination URL, when it differs from `content_url`
- `domain` — `self.<subreddit>` for text posts, otherwise the linked domain
- `post_hint` — Reddit's own content hint (`self`, `link`, `image`, `hosted:video`, …)
- `is_self` — whether the post is a text post
- `post_type` — `self`, `link`, `image`, `video`, `gallery`, or `poll`
- `media_type` — `text`, `link`, `image`, `video`, `gallery`, or `embed`
- `has_media` — whether the post carries image/video/gallery/poll/embed media
- `author`, `author_id` — the poster's username and fullname
- `author_flair`, `author_flair_css_class`, `author_flair_template_id`, `author_flair_type`, `author_flair_text_color`, `author_flair_background_color`, `author_flair_richtext` — the poster's community flair, when they have one
- `author_premium`, `author_is_blocked`, `author_patreon_flair` — poster's premium status, block status, and Patreon badge
- `subreddit`, `subreddit_prefixed`, `subreddit_id`, `subreddit_subscribers`, `subreddit_type` — the community the post belongs to
- `score`, `ups`, `downs`, `upvote_ratio` — vote totals and the up/down ratio
- `num_comments` — total comment count on the post at crawl time
- `num_crossposts`, `num_duplicates` — how often the post was crossposted, and how many other posts link the same destination (link posts only)
- `link_flair`, `link_flair_css_class`, `link_flair_richtext`, `link_flair_background_color`, `link_flair_text_color`, `link_flair_type` — the post's own flair, when set
- `thumbnail_url`, `thumbnail_width`, `thumbnail_height` — thumbnail image and dimensions, when a real thumbnail exists
- `created_utc`, `created_at` — when the post was submitted (Unix epoch and ISO-8601)
- `edited`, `edited_at` — whether and when the post was last edited
- `is_stickied`, `is_pinned` — whether the post is pinned by moderators / on the subreddit
- `is_locked`, `is_archived` — whether commenting/voting is closed
- `is_nsfw`, `is_spoiler` — content warnings
- `is_original_content` — whether the post is flagged OC
- `is_crosspost`, `crosspost_parent_id` — whether this is a crosspost, and the original post's id
- `is_crosspostable`, `is_meta`, `is_robot_indexable`, `is_reddit_media_domain`, `media_only`, `quarantine` — additional Reddit-assigned post attributes
- `no_follow`, `send_replies`, `allow_live_comments`, `contest_mode`, `hide_score`, `suggested_sort`, `content_categories` — post configuration flags Reddit reports
- `hidden` — whether the post is hidden
- `images` — image URLs from the post preview
- `gallery_images`, `gallery_count` — full-resolution gallery image URLs and item count (gallery posts)
- `video_url` — direct video file URL (video posts)
- `poll_data` — poll options and vote totals (poll posts)
- `embed_type`, `embed_provider`, `embed_title`, `embed_author_name`, `embed_author_url`, `embed_thumbnail_url`, `embed_html` — auto-embed data for link posts Reddit embeds from YouTube, Imgur, Gfycat, Twitch, etc.; omitted when the post has no external embed
- `gilded`, `total_awards_received`, `awards` — legacy and modern award counts, plus the award breakdown
- `removed_by_category` — who removed the post, when removed
- `distinguished` — `moderator` or `admin` when the poster acted in an official capacity
- `crawled_at` — when the actor fetched this record (ISO-8601)
- `source` — `json` (primary Reddit JSON endpoint) or `dom` (browser fallback)

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `postUrls` | array | – (required) | Post URLs, comment URLs, share links, `redd.it` short links, or bare post IDs — see accepted forms below |
| `maxComments` | integer | `100` | Maximum comments to scrape per post, including nested replies (1–100,000) |
| `commentSort` | select | `confidence` | `confidence` (Best), `top`, `new`, `controversial`, `old`, `qa` |
| `includePost` | boolean | `false` | Emit the parent post as a separate first record of each thread |
| `postedAfter` | date | – | Only keep comments created on/after this date (UTC) |
| `postedBefore` | date | – | Only keep comments created on/before this date (UTC; a bare date means end of that day) |
| `minDepth` | integer | – | Only keep comments at or deeper than this nesting level (0–100) |
| `maxDepth` | integer | – | Only keep comments at or above this nesting level (0–100) |
| `minCommentScore` | integer | – | Only keep comments with score ≥ this value |
| `maxCommentScore` | integer | – | Only keep comments with score ≤ this value |
| `onlyOP` | boolean | `false` | Keep only the original poster's own comments |
| `excludeDeletedRemoved` | boolean | `false` | Drop comments whose body/author shows as `[deleted]`/`[removed]` |
| `excludeStickied` | boolean | `false` | Drop moderator-pinned comments (e.g. AutoModerator notices) |
| `excludeCollapsed` | boolean | `false` | Drop comments Reddit collapses by default |
| `distinguishedFilter` | select | `any` | `any`, `moderator` (mod comments only), `admin` (admin comments only), `none` (regular users only) |
| `authors` | array | – | Only keep comments from these usernames (case-insensitive) |
| `excludeAuthors` | array | – | Drop comments from these usernames (case-insensitive), e.g. bots |
| `keywords` | array | – | Only keep comments containing at least one of these keywords/phrases |
| `excludeKeywords` | array | – | Drop comments containing any of these keywords/phrases |
| `minAwards` | integer | – | Only keep comments with at least this many total awards |
| `minCommentLength` | integer | – | Only keep comments whose body is at least this many characters (0–10,000) |
| `maxCommentLength` | integer | – | Only keep comments whose body is at most this many characters (0–10,000) |
| `controversialOnly` | boolean | `false` | Keep only comments Reddit flags as controversial (near-even up/downvote split) |
| `focusOnTargetComment` | boolean | `false` | When a `postUrls` item is a specific comment permalink, fetch only that comment plus its ancestor chain instead of the whole thread |
| `commentContext` | integer | `3` | Ancestor levels to include above the target comment (0–8; used only with `focusOnTargetComment`) |

**Accepted `postUrls` forms:**

- Full post URL: `https://www.reddit.com/r/programming/comments/1abc123/some_title/`
- Short URL: `https://www.reddit.com/comments/1abc123` (also with `?sort=top`)
- Comment URL: `https://www.reddit.com/r/x/comments/1abc123/title/comment/xyz987/`
- Share link: `https://www.reddit.com/r/x/s/<token>`
- Short link: `https://redd.it/1abc123`
- Bare post ID: `1abc123` or `t3_1abc123`
- `old.reddit.com` URLs also work

Malformed items (empty strings, garbage URLs, non-strings) are skipped without failing the run.

#### Example: scrape a whole thread sorted by Top

```json
{
  "postUrls": ["https://www.reddit.com/r/technology/comments/1abc123/some_title/"],
  "maxComments": 500,
  "commentSort": "top",
  "includePost": true
}
```

#### Example: recent, high-signal comments only

```json
{
  "postUrls": ["https://www.reddit.com/r/investing/comments/1abc123/some_title/"],
  "maxComments": 1000,
  "postedAfter": "2026-06-01",
  "minCommentScore": 5,
  "excludeDeletedRemoved": true,
  "excludeStickied": true
}
```

#### Example: NLP dataset — clean, filtered comment bodies

```json
{
  "postUrls": [
    "https://www.reddit.com/r/AskReddit/comments/1abc123/some_title/",
    "https://www.reddit.com/r/AskReddit/comments/1def456/other_title/"
  ],
  "maxComments": 5000,
  "excludeDeletedRemoved": true,
  "excludeAuthors": ["AutoModerator"],
  "minCommentLength": 20,
  "excludeKeywords": ["I am a bot"],
  "includePost": false
}
```

#### Example: jump straight to one comment

```json
{
  "postUrls": ["https://www.reddit.com/r/x/comments/1abc123/title/comment/xyz987/"],
  "focusOnTargetComment": true,
  "commentContext": 5
}
```

### Use cases

- **Sentiment & NLP datasets** — build large, labeled corpora from real Reddit discussions
- **Market & product research** — see what customers actually say about a product or brand in the replies
- **Community & moderation analysis** — study conversation structure, controversy, and OP engagement in a subreddit
- **Launch monitoring** — track reaction to announcements across subreddits with scheduled runs
- **Academic & social research** — export full, structured discussion threads for analysis
- **Customer support mining** — surface recurring complaints or questions buried in comment threads

### FAQ

**Do I need a Reddit account, API key, or login?**
No. The actor reads Reddit's public web data; no authentication is required.

**Does this actor use a proxy? Do I need to configure one?**
Yes, automatically — you don't need to configure anything. Reddit blocks requests from datacenter IPs (including Apify's free `AUTO` proxy group) with HTTP 403, so the actor always routes requests through an Apify Residential proxy pinned to the US. This isn't a user-facing choice because a residential proxy is required for reliable data; there's no reliable alternative to expose.

**Does it really capture the whole thread, including deeply nested replies?**
Yes. Reddit paginates comment listings and hides deeper replies behind "load more" placeholders; the actor resolves every placeholder recursively until `maxComments` is reached or the thread is exhausted.

**I set a high `maxComments`, but I got slightly fewer comments than the post's `num_comments` count. Is that a bug?**
No — this is a normal, well-understood platform limitation. Reddit's own `num_comments` counter includes comments that were later deleted/removed by their author (and, in some cases, transient counts that lag behind the live listing). On very large threads (10,000+ comments), a small percentage of comments can also be pruned by Reddit's listing API itself before the actor ever sees them. The actor returns every comment Reddit's API actually serves; it cannot recover comments Reddit itself no longer lists.

**What's the difference between `parent_id` and `link_id`?**
`link_id` always points to the parent post (`t3_...`). `parent_id` points to the comment's direct parent, which can be the post (`t3_...`, for a top-level comment) or another comment (`t1_...`, for a reply) — check `parent_kind` to tell which.

**What does `removed_by_category` mean?**
Who removed the comment or post: `moderator`, `automod_filtered`, `reddit`, or `author`/`deleted`. Live, non-removed records simply don't have this field.

**What does `collapsed_reason_code` mean?**
The machine-readable reason a comment is collapsed by default (e.g. `DELETED`). `collapsed_because_crowd_control` separately marks collapses caused by Reddit's crowd control feature. Comments collapsed purely for low score have `collapsed: true` with no reason fields.

**How do I scrape just one comment instead of the whole thread?**
Paste that comment's permalink URL (the one containing `/comment/{id}/`) into `postUrls` and enable `focusOnTargetComment`. You'll get that comment plus up to `commentContext` levels of its parent comments, the same view Reddit shows when you click a comment's "permalink".

**What happens for a private subreddit, banned post, or deleted post?**
The actor returns 0 records for that URL along with a status message, instead of failing the whole run — other URLs in the same run are unaffected.

**Is this affiliated with Reddit?**
No. This is an independent, third-party actor that reads Reddit's public web pages; it is not endorsed by or affiliated with Reddit, Inc.

**What export formats are supported?**
JSON, CSV, Excel, XML, and HTML, plus the Dataset REST API and Apify integrations (Zapier, Make, n8n, AI agents via the Apify MCP server).

# Actor input Schema

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

Post URLs, comment URLs, share links or bare post IDs. Accepted forms: full post URL (https://www.reddit.com/r/x/comments/1abc/title/), short URL (https://www.reddit.com/comments/1abc or with ?sort=top), comment URL (.../comments/1abc/title/comment/xyz/), mobile share link (https://www.reddit.com/r/x/s/token), bare post id (1abc123) or t3\_1abc123.

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

Maximum number of comments to scrape from each post (including nested replies).

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

How to sort the comment threads.

## `includePost` (type: `boolean`):

When enabled, the parent post is emitted as the first record of each thread (full post data included).

## `postedAfter` (type: `string`):

Only keep comments created on or after this date (UTC).

## `postedBefore` (type: `string`):

Only keep comments created on or before this date (interpreted as the end of that day, UTC).

## `minDepth` (type: `integer`):

Only keep comments nested at or deeper than this depth (0 = keep everything, 1 = drop top-level comments and keep only replies, 2 = keep only replies-to-replies and deeper, etc.). Leave empty for no limit.

## `maxDepth` (type: `integer`):

Only keep comments nested at or above this depth (0 = top-level comments only, 1 = top-level + first-level replies, etc.). Leave empty for no limit.

## `minCommentScore` (type: `integer`):

Only keep comments with a score (upvotes minus downvotes) at or above this value. Leave empty for no limit.

## `maxCommentScore` (type: `integer`):

Only keep comments with a score (upvotes minus downvotes) at or below this value. Leave empty for no limit.

## `onlyOP` (type: `boolean`):

When enabled, only comments written by the post's original author are kept.

## `excludeDeletedRemoved` (type: `boolean`):

When enabled, comments whose body or author show as \[deleted] or \[removed] are dropped (no real content left to scrape).

## `excludeStickied` (type: `boolean`):

When enabled, moderator-pinned (stickied) comments — e.g. AutoModerator notices — are dropped.

## `excludeCollapsed` (type: `boolean`):

When enabled, comments Reddit collapses by default (low score or crowd control) are dropped.

## `distinguishedFilter` (type: `string`):

Restrict output to comments with a specific 'distinguished' badge (moderator/admin posting in an official capacity), or only regular (non-distinguished) comments. Leave as 'Any' to keep everyone.

## `authors` (type: `array`):

Only keep comments written by these Reddit usernames (case-insensitive). Leave empty to keep comments from all authors.

## `excludeAuthors` (type: `array`):

Drop comments written by these Reddit usernames (case-insensitive), e.g. bots like AutoModerator. Leave empty to keep comments from all authors. Applied after `authors` (an author listed in both is excluded).

## `keywords` (type: `array`):

Only keep comments whose body contains at least one of these keywords or phrases (case-insensitive substring match). Leave empty to keep all comments.

## `excludeKeywords` (type: `array`):

Drop comments whose body contains any of these keywords or phrases (case-insensitive substring match), e.g. spam/boilerplate phrases. Applied after `keywords` (a keyword listed in both still excludes the comment). Leave empty to keep all comments.

## `minAwards` (type: `integer`):

Only keep comments with at least this many total awards. Leave empty for no limit.

## `minCommentLength` (type: `integer`):

Only keep comments whose body text is at least this many characters long. Useful for filtering out one-word/emoji-only noise when building NLP datasets. Leave empty for no limit.

## `maxCommentLength` (type: `integer`):

Only keep comments whose body text is at most this many characters long (Reddit's hard cap is 10,000 characters). Leave empty for no limit.

## `controversialOnly` (type: `boolean`):

When enabled, only keep comments Reddit flags as controversial (near-even up/downvote split, i.e. `controversiality: 1`).

## `focusOnTargetComment` (type: `boolean`):

When a `postUrls` item is a specific comment permalink (e.g. .../comments/1abc123/title/comment/xyz987/), only that comment plus its ancestor chain (see `commentContext`) is fetched instead of the full thread. Guarantees the target comment is captured even in huge threads where `maxComments` pagination might not reach it. Has no effect on plain post URLs.

## `commentContext` (type: `integer`):

How many levels of parent comments above the target comment to include when `focusOnTargetComment` is enabled (matches Reddit's own comment-permalink page). Ignored otherwise.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.reddit.com/r/programming/comments/1vqukkf/nothing_like_a_monday_morning_github_outage/",
    "https://www.reddit.com/comments/1tlh5aj"
  ],
  "maxComments": 100,
  "commentSort": "confidence",
  "includePost": false,
  "postedAfter": "2025-01-01",
  "postedBefore": "2025-12-31",
  "minDepth": 1,
  "maxDepth": 2,
  "minCommentScore": 1,
  "maxCommentScore": 1000,
  "onlyOP": false,
  "excludeDeletedRemoved": false,
  "excludeStickied": false,
  "excludeCollapsed": false,
  "distinguishedFilter": "any",
  "authors": [
    "spez"
  ],
  "excludeAuthors": [
    "AutoModerator"
  ],
  "keywords": [
    "thanks",
    "great point"
  ],
  "excludeKeywords": [
    "I am a bot",
    "check out my"
  ],
  "minAwards": 1,
  "minCommentLength": 20,
  "maxCommentLength": 2000,
  "controversialOnly": false,
  "focusOnTargetComment": false,
  "commentContext": 3
}
```

# Actor output Schema

## `commentAndPostRecords` (type: `string`):

Dataset containing one record per comment, plus the parent post record when 'Include post' is on. Records are distinguished by the `dataType` field (`comment` or `post`).

# 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 = {
    "postUrls": [
        "https://www.reddit.com/r/programming/comments/1vqukkf/"
    ],
    "maxComments": 30,
    "commentSort": "confidence",
    "includePost": false,
    "onlyOP": false,
    "excludeDeletedRemoved": false,
    "excludeStickied": false,
    "excludeCollapsed": false,
    "distinguishedFilter": "any",
    "controversialOnly": false,
    "focusOnTargetComment": false,
    "commentContext": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/reddit-comment-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 = {
    "postUrls": ["https://www.reddit.com/r/programming/comments/1vqukkf/"],
    "maxComments": 30,
    "commentSort": "confidence",
    "includePost": False,
    "onlyOP": False,
    "excludeDeletedRemoved": False,
    "excludeStickied": False,
    "excludeCollapsed": False,
    "distinguishedFilter": "any",
    "controversialOnly": False,
    "focusOnTargetComment": False,
    "commentContext": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/reddit-comment-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 '{
  "postUrls": [
    "https://www.reddit.com/r/programming/comments/1vqukkf/"
  ],
  "maxComments": 30,
  "commentSort": "confidence",
  "includePost": false,
  "onlyOP": false,
  "excludeDeletedRemoved": false,
  "excludeStickied": false,
  "excludeCollapsed": false,
  "distinguishedFilter": "any",
  "controversialOnly": false,
  "focusOnTargetComment": false,
  "commentContext": 3
}' |
apify call crawlerbros/reddit-comment-scraper --silent --output-dataset

```

## MCP server setup

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