# Reddit Comment Scraper By Keyword Search (`scraper-engine/reddit-comments-scraper`) Actor

Reddit Comments Scraper extracts comments from Reddit posts with full context. Collect comment text, authors, scores, timestamps, and reply depth for sentiment analysis, research, moderation, and data-driven content insights.

- **URL**: https://apify.com/scraper-engine/reddit-comments-scraper.md
- **Developed by:** [Scraper Engine](https://apify.com/scraper-engine) (community)
- **Categories:** Social media, Lead generation, Agents
- **Stats:** 11 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$19.99/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## 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 — Text, Upvotes and Timestamps by Keyword

Reddit Comment Scraper By Keyword Search pulls every comment from a Reddit post — plain text, author, upvote count, and absolute timestamp — without needing a Reddit account or API key. Feed it direct post URLs, a subreddit or search URL, or just a keyword, and it discovers matching posts and extracts their comments as structured JSON, ready to filter, analyze, or feed into an LLM. Run it now on Apify to pull your first batch of comments in minutes.

### What is Reddit Comment Scraper By Keyword Search?

Reddit Comment Scraper By Keyword Search is an Apify Actor that discovers Reddit posts by keyword, subreddit, or direct URL, then extracts every comment on each post as clean, structured JSON — including nested replies, real timestamps, and derived content type. It runs entirely against Reddit's public pages; no Reddit account, OAuth app, or login is required. It's built for marketers tracking brand or product mentions, researchers studying community discussions, and developers or AI engineers who need Reddit comment data as a clean input for analysis or LLM pipelines.

### What Reddit comment data is publicly available to scrape?

Reddit exposes full post threads — comments, authors, scores, and timestamps — to anyone browsing without an account. What's gated sits behind community membership or an active Reddit login, not behind the comment itself.

| Data Category | Publicly Available | Restricted |
| --- | --- | --- |
| Comments on public posts (text, score, timestamp) | Yes | — |
| Comment author username, avatar, permalink | Yes | — |
| Nested replies and reply threads | Yes | — |
| Private / invite-only subreddit content | No | Requires membership + login |
| Quarantined subreddit content | No | Requires an opted-in, logged-in account |
| Deleted or removed comment bodies | No — Reddit itself blanks the text | Not recoverable even with login |
| Private messages, saved/upvoted history | No | Always requires login as that account |

Reddit Comment Scraper By Keyword Search only returns publicly visible data — what any visitor sees. Nothing behind a login wall.

### What data can I extract with Reddit Comment Scraper By Keyword Search?

Every run returns one row per comment, covering post context, author identity, and the comment's content and engagement — 15 fields total (14 shown in the default dataset view, plus the nested `replies` field).

#### Post & comment identity

| Field Name | Description |
| --- | --- |
| `url` | The post URL this comment was scraped from |
| `discovered_post_title` | The post's real title, read from Reddit's own JSON for that post |
| `discovered_via` | How the post was found: `direct_url` or `search` |
| `comment_id` | Reddit's unique ID for this comment |
| `post_id` | Reddit's fullname ID for the parent post (e.g. `t3_1epeshq`) |
| `permalink` | Direct link to this specific comment |
| `parent_id` | ID of the parent comment (or the post, for top-level comments) |

#### Author fields

| Field Name | Description |
| --- | --- |
| `author` | Commenter's Reddit username |
| `userUrl` | Link to the commenter's public Reddit profile |
| `author_avatar` | The commenter's real avatar image URL, resolved from their public profile |

#### Content, engagement & replies

| Field Name | Description |
| --- | --- |
| `contentText` | The comment's text body |
| `content_type` | Derived from the real comment body/media: `text`, `image`, `video`, or `deleted` |
| `upvotes` | The comment's score |
| `created_time` | Absolute ISO-8601 UTC timestamp, derived from Reddit's real `created_utc` |
| `replies` | Nested reply objects (same field shape), depth controlled by `maxReplyDepth` |

##### 🤖 Add-on: Need additional Reddit data?

Scraper-Engine doesn't currently publish a second Reddit-specific Actor, so this one is the account's single deep entry point for Reddit comment data — covering direct URLs, subreddit discovery, and keyword search in one run. If your project also needs comment data from other platforms, see the [Related scrapers](#related-scrapers) table below for Facebook, Instagram, and YouTube comment Actors from the same account.

### How does Reddit Comment Scraper By Keyword Search differ from the official Reddit API?

Reddit's official Data API requires an approved OAuth application and, since Reddit's 2023 pricing change, a separate paid commercial agreement for high-volume or commercial use — this Actor needs neither. Figures below are as publicly reported following that 2023 change and confirmed against multiple current third-party summaries as of 2026-07-25; Reddit negotiates exact commercial pricing per agreement.

| Feature | Reddit Data API | Reddit Comment Scraper By Keyword Search |
| --- | --- | --- |
| Authentication | OAuth app registration, reviewed by Reddit | None — reads Reddit's own public pages directly |
| Commercial use | Requires a separate paid commercial agreement with Reddit (reported near $0.24 per 1,000 calls) | Pay-per-result on Apify; no separate Reddit contract |
| Free-tier scope | Free access is limited to non-commercial use, under Reddit's OAuth rate limits | Same Actor and pricing regardless of use case |
| Keyword/subreddit discovery | You build your own calls against approved search/listing endpoints | Built in — pass a keyword, subreddit URL, or search URL directly |
| Listing depth | Public reporting notes listing endpoints (`/new`, `/top`, `/hot`) cap out around 1,000 items | `maxPostsToDiscover` (up to 500) and `maxCommentsPerPost` (up to 10,000) set per run |
| Time-window filtering | No native since/until filter on comments | `sinceDate` / `untilDate` filter directly on real `created_time` |

Use the official API when you're building a Reddit-native app that needs authenticated actions like posting or voting. Use this Actor for bulk, read-only comment extraction for research, monitoring, or feeding an LLM pipeline, without an OAuth approval process.

### How to use Reddit Comment Scraper By Keyword Search

Reddit Comment Scraper By Keyword Search runs as an Apify Actor — there's no separate signup or API key beyond an Apify account.

1. Open the Actor's page on Apify and click **Run**, either in Apify Console or via the API.
2. Provide at least one way in: paste `postUrls` (direct Reddit post links), a `searchUrls` subreddit/search link, or a plain `query` keyword — all three are optional in the schema, but the Actor needs one to find anything.
3. Optionally set `sort`, `maxPostsToDiscover`, `maxCommentsPerPost`, `maxReplyDepth`, `sinceDate`/`untilDate`, and `safeSearch`.
4. Start the run.
5. Download results as JSON, CSV, or Excel from the run's dataset, or stream them via the API.

#### How to scale to bulk Reddit comment extraction

`postUrls` and `searchUrls` both accept arrays, so pasting dozens of post links or several subreddit/search URLs into one input runs them all in a single call — the Actor fetches them concurrently and dedupes overlapping targets automatically. There's no separate "bulk mode": add more entries to either array, or combine several `searchUrls` with one `query`, and raise `maxPostsToDiscover` to widen coverage in that same run.

### What can you do with Reddit comment data?

- A brand manager monitoring mentions uses `contentText` and `created_time` (filtered with `sinceDate`/`untilDate`) to track how sentiment about a product shifts week over week.
- A market researcher exploring a topic uses `query` or `searchUrls` discovery plus `discovered_post_title` and `upvotes` to surface the highest-engagement threads on that subject.
- A community manager uses `author` and `userUrl` to identify the most active commenters in a target subreddit for outreach or moderation.
- A growth analyst compares `upvotes` and `content_type` across discovered posts to see which comment formats (text, image, video) drive the most engagement.
- An AI engineer feeds `contentText` alongside `parent_id`/`replies` thread structure into a RAG pipeline or an LLM sentiment-classification prompt to auto-summarize entire comment sections.

### How does Reddit Comment Scraper By Keyword Search handle rate limits and blocking?

The Actor tries a direct request to Reddit's public `.json` endpoints first. If Reddit returns a blocked or rate-limited response and you left proxy settings on default, it automatically retries through Apify's datacenter proxy, then residential proxy, as a resilience net. If you explicitly configure `proxySettings`, every retry uses exactly the group/country you selected instead. Retries back off exponentially between attempts.

If Reddit's `.json` API is unavailable network-wide for a given post — a known environment-level block, not specific to any one request — the Actor automatically falls back to the public Arctic Shift and PullPush Reddit comment archives so it still returns real comment data instead of failing silently. The same fallback applies to post discovery via keyword or subreddit search. Comments that can't be fetched from any source for a given URL are logged and skipped; the run continues with the remaining targets rather than aborting.

### ⬇️ Input

All 11 parameters are optional — provide at least one of `postUrls`, `searchUrls`, or `query` for the Actor to find comments.

| Parameter | Required | Type | Description | Example Value |
| --- | --- | --- | --- | --- |
| `postUrls` | No | array | Direct Reddit post URLs to scrape comments from. Leave empty to rely on discovery below. | `["https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/"]` |
| `searchUrls` | No | array | Subreddit-listing URLs or Reddit search URLs to auto-discover matching posts, then scrape their comments. | `["https://www.reddit.com/r/ChatGPT/"]` |
| `query` | No | string | A plain keyword or phrase used to discover matching posts across all of Reddit when no `postUrls`/`searchUrls` are supplied. | `"prompt engineering tips"` |
| `sort` | No | string (enum: `hot`, `new`, `top`, `controversial`, `old`) | Order comments are fetched in. Default is `hot`. | `"new"` |
| `safeSearch` | No | boolean | When true, NSFW/over-18 posts found via discovery are skipped. Does not affect directly-pasted post URLs. Default is off. | `true` |
| `maxPostsToDiscover` | No | integer | Cap on how many posts are discovered from `searchUrls`/`query` before their comments are fetched. Range 1-500. Default is 10. | `25` |
| `maxCommentsPerPost` | No | integer | Maximum number of comments to extract per post. Range 1-10,000. Default is 100. | `200` |
| `maxReplyDepth` | No | integer | Number of nested replies kept in each comment's `replies` field. 0 = unlimited. All replies are still collected in the flattened output regardless. Default is 2. | `3` |
| `sinceDate` | No | string (datepicker, absolute or relative) | Only keep comments posted on/after this date, filtered on the real `created_time`. | `"2026-01-01"` |
| `untilDate` | No | string (datepicker, absolute or relative) | Only keep comments posted on/before this date, filtered on the real `created_time`. | `"2026-07-01"` |
| `proxySettings` | No | object | Proxy configuration. By default, no proxy is used and only direct requests are made; when enabled, the Actor uses exactly the group/country you select, with retries. | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` |

#### Example input

```json
{
  "postUrls": ["https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/"],
  "searchUrls": ["https://www.reddit.com/r/ChatGPT/"],
  "query": "prompt engineering tips",
  "sort": "new",
  "safeSearch": true,
  "maxPostsToDiscover": 25,
  "maxCommentsPerPost": 200,
  "maxReplyDepth": 3,
  "sinceDate": "2026-01-01",
  "untilDate": "2026-07-01",
  "proxySettings": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### ⬆️ Output

Every run writes one typed JSON row per comment to the Actor's dataset, with a consistent schema across runs. Export it as JSON, CSV, Excel, or HTML directly from Apify, or pull it through the API.

#### Example output

```json
{
  "url": "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/",
  "discovered_post_title": "These are all AI generated images",
  "discovered_via": "direct_url",
  "comment_id": "lh3k9a2",
  "post_id": "t3_1epeshq",
  "author": "midjourney_fan99",
  "permalink": "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/lh3k9a2/",
  "upvotes": 342,
  "content_type": "text",
  "parent_id": "t3_1epeshq",
  "author_avatar": "https://styles.redditmedia.com/t5_2qh1u/styles/profileIcon_snoo.png",
  "userUrl": "https://www.reddit.com/user/midjourney_fan99/",
  "contentText": "The lighting on the third one gave it away instantly.",
  "created_time": "2026-06-14T09:32:11Z",
  "replies": [
    {
      "comment_id": "lh3l0b7",
      "post_id": "t3_1epeshq",
      "author": "skeptical_sam",
      "permalink": "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/lh3l0b7/",
      "upvotes": 58,
      "content_type": "text",
      "parent_id": "lh3k9a2",
      "author_avatar": "",
      "userUrl": "https://www.reddit.com/user/skeptical_sam/",
      "contentText": "Which one is the third? They're numbered weird.",
      "created_time": "2026-06-14T10:01:47Z",
      "replies": []
    }
  ]
}
```

### How does it work?

Reddit Comment Scraper By Keyword Search sends direct HTTP requests to Reddit's own public `.json` endpoints — the same JSON contract that powers reddit.com itself — so no browser rendering is needed. Requests try a direct connection first; if Reddit blocks or rate-limits the response, the Actor retries through Apify Proxy (your configured settings, or a default datacenter-then-residential fallback), and if Reddit's endpoint is unavailable network-wide, it fails over to public Reddit comment archives so real data still comes back. Only publicly visible posts and comments are ever returned — nothing that requires a login. Because the Actor targets Reddit's stable JSON structure rather than scraping rendered HTML, the output schema stays consistent even as Reddit's front-end UI changes.

### Integrations

Reddit Comment Scraper By Keyword Search runs on Apify, so it works with any tool that can call an HTTP API or the Apify SDK.

#### Calling Reddit Comment Scraper By Keyword Search programmatically

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_API_TOKEN>")

run_input = {
    "searchUrls": ["https://www.reddit.com/r/ChatGPT/"],
    "query": "prompt engineering tips",
    "maxPostsToDiscover": 25,
    "maxCommentsPerPost": 200,
}

run = client.actor("YOUR_USERNAME/reddit-comment-scraper-by-keyword-search").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["contentText"])
```

Works in Go, Ruby, Node.js, cURL — any language that can make an HTTP request.

#### No-code tools (n8n, Make, LangChain)

In n8n, use the Apify integration node (or the HTTP Request node against the Apify API) to start a run and read back the dataset. In Make, use the Apify app's "Run an Actor" module and feed the resulting dataset items into downstream scenarios. In LangChain or a similar framework, wrap the Apify API call as a tool and pass the returned JSON comments directly into your chain or agent as context.

### Is it legal to scrape Reddit comments?

Scraping publicly available Reddit comments is generally lawful, since this Actor only collects data any logged-out visitor can already see — no private subreddits, no login-walled content. Reddit usernames are pseudonymous handles, not real names by default, but a username combined with an avatar and comment history is still a persistent identifier, so GDPR/CCPA-style personal-data considerations can apply if you store and process this data at scale, particularly for EU or California residents. Reddit's Terms of Service also govern how scraped content may be reused. Consult legal counsel if your use case involves bulk storage or processing of personal data.

### Frequently asked questions

#### What Reddit comment fields does Reddit Comment Scraper By Keyword Search return?

It returns `contentText`, `author`, `upvotes`, `created_time`, and `permalink` as its core fields, plus post context, author avatar, and nested `replies`. See the [full fields table](#what-data-can-i-extract-with-reddit-comment-scraper-by-keyword-search) above.

#### Does Reddit Comment Scraper By Keyword Search require a Reddit account or login?

No. The Actor sends unauthenticated requests to Reddit's public `.json` endpoints — no Reddit account, OAuth app, or cookies are used or required.

#### How many Reddit comments can I extract in one run?

Up to `maxCommentsPerPost` (max 10,000) per post, across as many `postUrls` as you paste plus up to `maxPostsToDiscover` (max 500) posts found via `searchUrls`/`query` in that same run.

#### What happens if a keyword or subreddit search returns zero results?

The Actor logs that no post URLs or discovery results were found and exits without writing any dataset rows, rather than throwing an error — check your `query`/`searchUrls` input and re-run.

#### Can I scrape multiple Reddit posts or subreddits at once?

Yes. `postUrls` and `searchUrls` both accept arrays, so you can paste many post links and several subreddit/search URLs into a single run; they're processed concurrently and deduplicated automatically.

#### Does Reddit Comment Scraper By Keyword Search work with Claude, ChatGPT, and other AI agent tools?

Yes — it's callable as a standard HTTP endpoint through the Apify API, so any agent framework that can make an HTTP call (LangChain, custom Claude/GPT tool definitions, etc.) can trigger a run and read back the JSON dataset.

#### How does Reddit Comment Scraper By Keyword Search compare to other Reddit comment scrapers?

It combines three discovery paths — direct post URLs, subreddit/search URL discovery, and plain-keyword search — with a single comment-extraction engine, plus a built-in archive fallback (Arctic Shift/PullPush) when Reddit's own JSON API is blocked. Evaluate any alternative against your own required fields, discovery flexibility, and whether it degrades gracefully when Reddit's endpoint is unavailable.

#### Does Reddit Comment Scraper By Keyword Search return data in a format LLMs can use directly?

Yes. Output is typed, normalized JSON with consistent field names across runs — no HTML parsing or CSS selectors needed. Pass it directly to an LLM prompt, index it into a vector store, or feed it to an agent tool.

#### What happens when Reddit changes its layout or anti-bot system?

The Actor is maintained against Reddit's JSON API contract, and the output schema is designed to stay stable across Reddit UI changes. No specific update turnaround time is guaranteed.

#### Can I use Reddit Comment Scraper By Keyword Search without managing proxies or browser infrastructure?

Yes. There's no browser to configure — requests go straight to Reddit's JSON API — and proxy rotation (datacenter/residential fallback, or your chosen groups) is handled by the Actor automatically.

#### Which Reddit comment fields work best for AI training data and RAG indexing?

For RAG, index `contentText` alongside `discovered_post_title` and `permalink` for retrievable context with a source link. For training data or structured analysis, `created_time`, `upvotes`, and `content_type` return as consistent typed primitives (string, integer, and string enum respectively) across every record.

### Related scrapers

| Scraper Name | What it extracts |
| --- | --- |
| Facebook Comments Scraper: Reaction Breakdown | Facebook post comments with per-comment reaction breakdown (like/love/haha/wow/sad/angry/care) and derived engagement metrics |
| Instagram Comments Scraper With Lead Enrichment | Instagram post/reel comments enriched with lead/contact data |
| YouTube Comments Scraper : AI Sentiment Analytics | YouTube video comments with AI-driven sentiment analytics |

### Your feedback

Found a bug or missing a field in Reddit Comment Scraper By Keyword Search? Let us know through the Actor's Issues tab on Apify so we can take a look. Feedback like this is what keeps the Actor accurate as Reddit's own site evolves.

# Actor input Schema

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

📋 Paste one or more direct Reddit post URLs to scrape comments from (base field, was `startUrls`). Example: https://www.reddit.com/r/subreddit/comments/post\_id/title/. Leave empty to rely on discovery below.

## `searchUrls` (type: `array`):

🔍 Paste subreddit-listing URLs (e.g. https://www.reddit.com/r/AskReddit/) or Reddit search URLs (e.g. https://www.reddit.com/search/?q=ai) to auto-discover matching posts, then scrape each post's comments.

## `query` (type: `string`):

🔎 A plain keyword or phrase (e.g. "local business marketing") used to discover matching posts across all of Reddit when no `postUrls`/`searchUrls` are supplied.

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

📶 Order comments are fetched in (was the previously-dead `sortOrder`, now wired). Default is `hot`.

## `safeSearch` (type: `boolean`):

🚫 When checked, NSFW/over-18 posts found via discovery (search/subreddit) are skipped. Unchecked (default) matches base behavior — no NSFW filtering. Does not affect directly-pasted post URLs.

## `maxPostsToDiscover` (type: `integer`):

🔢 Cap on how many posts are discovered from `searchUrls`/`query` before their comments are fetched. Range: 1-500.

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

⚙️ Set the maximum number of comments to extract from each post (direct or discovered). Range: 1-10,000 comments. Default is 100. (Base field, was `maxComments`.)

## `maxReplyDepth` (type: `integer`):

🌳 Control the depth of nested replies stored in the `replies` field. Set to 0 for unlimited depth. All replies are still collected in the flattened output regardless of this setting. Default is 2. (Base field, was `replyLimit`.)

## `sinceDate` (type: `string`):

⏳ Only keep comments posted on/after this date (absolute e.g. 2026-01-01, or relative e.g. 3 days). Filters on the real `created_time` field. Leave empty for no lower bound.

## `untilDate` (type: `string`):

⏳ Only keep comments posted on/before this date (absolute e.g. 2026-12-31, or relative e.g. 1 day). Filters on the real `created_time` field. Leave empty for no upper bound.

## `proxySettings` (type: `object`):

🔒 Configure proxy settings for reliable scraping (base field, was `proxyConfiguration`). By default (unchecked), no proxy is used and only direct requests are made. When enabled, the actor uses exactly the proxy group/country you select, with retries.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/"
  ],
  "searchUrls": [],
  "sort": "hot",
  "maxPostsToDiscover": 10,
  "maxCommentsPerPost": 100,
  "maxReplyDepth": 2,
  "proxySettings": {
    "useApifyProxy": false
  }
}
```

# 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/ChatGPT/comments/1epeshq/these_are_all_ai/"
    ],
    "searchUrls": [],
    "query": "",
    "sort": "hot",
    "safeSearch": false,
    "maxCommentsPerPost": 100,
    "maxReplyDepth": 2,
    "proxySettings": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper-engine/reddit-comments-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/ChatGPT/comments/1epeshq/these_are_all_ai/"],
    "searchUrls": [],
    "query": "",
    "sort": "hot",
    "safeSearch": False,
    "maxCommentsPerPost": 100,
    "maxReplyDepth": 2,
    "proxySettings": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("scraper-engine/reddit-comments-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 '{
  "postUrls": [
    "https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/"
  ],
  "searchUrls": [],
  "query": "",
  "sort": "hot",
  "safeSearch": false,
  "maxCommentsPerPost": 100,
  "maxReplyDepth": 2,
  "proxySettings": {
    "useApifyProxy": false
  }
}' |
apify call scraper-engine/reddit-comments-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/MPL7sXctGBpHAJyTo/builds/WrIf0jZmFhUiHgSIV/openapi.json
