# Reddit Scraper | Posts, Comments, Subreddits & Users (`genial_candlestand/reddit-posts-comments-scraper`) Actor

Get Reddit posts, comments, subreddits and users as flat rows: title, text, score, upvote ratio, comment count, author and publish date. Subreddit feeds, full comment threads, search for posts, comments, communities or people, and user feeds in one run. No login or API key.

- **URL**: https://apify.com/genial_candlestand/reddit-posts-comments-scraper.md
- **Developed by:** [Flowo](https://apify.com/genial_candlestand) (community)
- **Categories:** Social media, Lead generation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.13 / 1,000 reddit results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Reddit Scraper | Posts, Comments, Subreddits & Users

![Reddit Scraper | Posts, Comments, Subreddits & Users](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/reddit-com-all-in-one-platform-scraper-banner-6f4542e4.png)

Get public Reddit data as flat rows: post title, text, score, upvote ratio, comment count, flair, author and publish date, plus full comment threads with the parent comment and nesting depth. One run can mix subreddit feeds, post URLs, Reddit search (posts, comments, communities or people) and user feeds. No login, no Reddit account and no API key.

### What does Reddit Scraper do?

You give it subreddit names, search terms, usernames or any reddit.com URLs. It returns one row per item, and the `type` column says what the row is: `post`, `comment`, `subreddit` or `user`. Because every row is flat, the dataset opens directly in Excel, Google Sheets, a BI tool or an AI pipeline. It is built for marketers tracking brand mentions, founders and analysts looking for pain points in a community, data teams collecting discussion text, and AI agents that need to know what Reddit says about a topic.

### How to scrape Reddit posts and comments

![How Reddit Scraper works: Opens a warm session on reddit.com over a residential proxy; Reads subreddit feeds, searches, user feeds and post pages page by page; Follows more-comments links until the pe](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/reddit-com-all-in-one-platform-scraper-how-d3f2e8f5.png)

1. Open the actor in Apify Console and click **Try for free**.
2. Add at least one source: **Reddit URLs**, **Search terms**, **Subreddits** or **Users**. You can combine them in one run.
3. Choose the order: **Subreddit sort** for feeds, **Search for** and **Search sort** for search terms, **User content** for users. Set **Time range** for Top and Controversial feeds and for post and comment searches.
4. Optionally switch on **Add comments of every post** and set **Max comments per post** (up to 5,000).
5. Set limits with **Max results per source** and **Max results in total**, and filter with **Only posted after** and **Include NSFW**.
6. Click **Start**. When the run finishes, download the dataset as JSON, CSV, Excel or HTML, or read it through the API.

### How much does it cost to scrape Reddit?

Price per event by Apify plan:

| Event | Free | Bronze | Silver | Gold and above |
|---|---|---|---|---|
| Actor start | $0.00005 | $0.00005 | $0.00005 | $0.00005 |
| Reddit result | $2.50 per 1,000 | $2.375 per 1,000 | $2.25 per 1,000 | $2.125 per 1,000 |

A test run with the API example input below returned 30 rows in 14 s.

You pay per result: one paid event is one row saved to the dataset — a post, a comment, a subreddit or a user. Every row type has the same price. On top of that, Apify charges the default Actor start event once per run (per GB of memory; the actor runs on 256 MB).

Not charged:

- duplicates (the same post found by two sources is saved once);
- NSFW posts and communities skipped because **Include NSFW** is off;
- posts and comments skipped by **Only posted after**;
- empty, banned, private or nonexistent subreddits and users — they give a log warning and no rows.

Example costs on the Free plan ($0.0025 per result, start $0.00005):

| Scenario | Paid results | Cost |
|---|---|---|
| 100 newest posts of one subreddit | 100 | $0.25005 |
| The prefilled example input (one post with comments, one search, one subreddit), about 200 rows | ~200 | ~$0.50005 |
| 25 top posts of the week with 50 comments each | 25 + 1,250 = 1,275 | $3.18755 |
| One post URL with 1,000 comments | 1 + 1,000 = 1,001 | $2.50255 |

### Input

![Reddit Scraper input example: Search for, Search sort, Subreddits, Subreddit sort, User content, Add comments of every post, Max comments per post](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/reddit-com-all-in-one-platform-scraper-input-74f714a7.png)

At least one source field is required: `startUrls`, `queries`, `subreddits` or `users`. Sources run in this order: URLs, subreddits, search terms, users.

| Field | What it does |
|---|---|
| `startUrls` | reddit.com URLs: a subreddit (optionally with `/top/?t=week`), a post (`/r/<sub>/comments/<id>/<slug>/` — the post and its comments), a user (`/user/<name>/`, `/submitted/` = posts, `/comments/` = comments) or a search (`/search/?q=…&type=…`, `/r/<sub>/search/?q=…`). Sort, time and type in the URL override the fields below. `old.`, `np.`, `m.` and `new.reddit.com` are accepted. |
| `queries` | Search terms, one per line |
| `searchType` | `posts` (default), `comments`, `communities` or `people` |
| `searchSort` | `relevance` (default), `new`, `top`, `comments` (most comments) or `hot` — for post and comment searches only |
| `searchSubreddit` | Limit post and comment searches to one subreddit; with `communities` or `people` the run stops with an input error |
| `subreddits` | Subreddit names (a leading `r/` or a full URL is accepted) |
| `sort` | Feed order: `hot` (default), `new`, `top`, `rising`, `controversial` or `best` |
| `time` | `hour`, `day`, `week`, `month`, `year` or `all` — for Top and Controversial feeds and for post and comment searches; ignored with a warning for other feeds; empty = Reddit's default |
| `users` | Usernames (a leading `u/` or a profile URL is accepted) |
| `userContent` | `posts` (default), `comments` or `overview` (both). User feeds are always newest first. |
| `includeComments` | Add the comment thread of every post found in feeds, user feeds and post searches (default off). Post URLs always get their comments. |
| `maxCommentsPerPost` | 0–5,000 comments per post (default 100); 0 = only the post row of a post URL |
| `commentSort` | `best` (default), `top`, `new`, `controversial` or `old` |
| `postedAfter` | Keep only posts and comments newer than an absolute date (2026-01-31) or a relative one (7 days, 12 hours); not applied to communities and people |
| `includeNsfw` | Keep NSFW posts and communities (default off) |
| `maxItemsPerSource` | 1–1,000 posts, search results or user items per source (default 100) |
| `maxItems` | Rows in the whole run (default 1,000) |
| `proxyConfiguration` | Residential proxy, US, by default |

Example — the top posts of the week in r/rust with up to 50 comments each:

```json
{
  "subreddits": ["rust"],
  "sort": "top",
  "time": "week",
  "includeComments": true,
  "maxItemsPerSource": 25,
  "maxCommentsPerPost": 50
}
```

Example — the newest comments that mention pricing in r/SaaS:

```json
{
  "queries": ["pricing"],
  "searchType": "comments",
  "searchSubreddit": "SaaS",
  "searchSort": "new"
}
```

### What data can you extract from Reddit?

![Reddit Scraper output example: Type, Title, Subreddit, Author, Score](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/reddit-com-all-in-one-platform-scraper-output-4c830546.png)

Every row has `type`, `id`, `url`, `source` and `scrapedAt`. The other fields depend on the row type and are `null` when they do not apply. Ids have no Reddit prefix, except `subredditId` (`t5_…`) and `authorId` (`t2_…`).

| Field | Rows | Description |
|---|---|---|
| `type` | all | `post`, `comment`, `subreddit` or `user` |
| `id`, `url` | all | Reddit id and reddit.com permalink |
| `source` | all | The input that produced the row: `r/<name>`, `u/<name>`, `search:<type>:<term>` or the start URL |
| `query` | search rows | The search term |
| `title` | posts | Post title |
| `text` | posts, comments | Plain text of a self post or comment (null for link, image and video posts without a body) |
| `postType` | posts | e.g. `text`, `link`, `image`, `gallery`, `video`, `crosspost`, `multi_media` |
| `linkUrl`, `domain` | posts | Link or media URL and its domain |
| `imageUrl` | posts, users | Post thumbnail or user avatar |
| `flair` | posts | Post flair text (depends on the subreddit) |
| `score` | posts, comments | Upvotes minus downvotes |
| `upvoteRatio` | posts | Share of upvotes, 0–1 (feed posts and post pages) |
| `commentCount`, `awardCount` | posts | Number of comments and awards |
| `subreddit`, `subredditId` | posts, comments from search, subreddits | Subreddit name without `r/` and its id |
| `author`, `authorId`, `authorUrl` | posts, comments | Author username, id and profile URL (null for `[deleted]`) |
| `language` | posts | Language code detected by Reddit |
| `publishedAt` | posts, comments | Publish date, ISO 8601 |
| `isNsfw`, `isSpoiler` | posts (`isNsfw` also subreddits) | NSFW and spoiler flags |
| `postId`, `postTitle` | comments | The post a comment belongs to (`postTitle` in comment search rows) |
| `parentId`, `depth` | comments in threads | Parent comment id (null for top-level) and nesting level (0 = top-level) |
| `isDeleted` | comments in threads | The author deleted the comment or account |
| `description`, `subscribers` | subreddits | Community description and member count |
| `username`, `karma` | users | Username and total karma (people search) |
| `scrapedAt` | all | When the row was extracted |

A real post row from r/programming:

```json
{
  "type": "post",
  "id": "1xr4v4f",
  "url": "https://www.reddit.com/r/programming/comments/1xr4v4f/sem86_a_fullsystem_emulator_without_hardcoded/",
  "title": "Sem86 - A full-system emulator without hardcoded semantics",
  "text": null,
  "postType": "link",
  "linkUrl": "https://liblisa.nl/sem86/",
  "domain": "liblisa.nl",
  "imageUrl": null,
  "flair": null,
  "score": 15,
  "upvoteRatio": 0.8,
  "commentCount": 1,
  "awardCount": 0,
  "subreddit": "programming",
  "subredditId": "t5_2fwo",
  "author": "mttd",
  "authorUrl": "https://www.reddit.com/user/mttd/",
  "authorId": "t2_6gkbb",
  "language": "en",
  "publishedAt": "2026-11-08T18:09:53.618Z",
  "isNsfw": false,
  "isSpoiler": false,
  "source": "r/programming",
  "scrapedAt": "2026-11-08T22:02:37.566Z"
}
```

A comment row carries `postId`, `parentId`, `depth`, `author`, `authorUrl`, `text`, `score`, `publishedAt` and `isDeleted`. A subreddit row carries `subreddit`, `subredditId`, `description`, `subscribers` and `isNsfw`. A user row carries `username`, `karma` and `imageUrl`.

### Use cases

- **Monitor subreddits:** scrape `r/programming` and `r/de` sorted by New with **Only posted after** = 1 day and get yesterday's posts with score, upvote ratio, comment count, flair and link.
- **Brand mentions and keyword research:** search posts or comments for "notion alternative", sorted by Top over the past month, optionally only inside r/productivity.
- **Full discussion of a post:** give a post URL with up to 1,000 comments sorted by Top, and rebuild the thread from `parentId` and `depth`.
- **Find communities and people:** search communities for "python" to get subreddit names, descriptions, member counts and NSFW flags, or search people to get usernames and karma.
- **User activity:** collect the posts, comments or both of a user such as `spez`, newest first.

### Limitations

- Reddit lists (feeds and search) stop at about 1,000 items, so **Max results per source** is capped at 1,000.
- r/all and r/popular, short `redd.it` links, `/comments/<id>` URLs without `/r/<sub>/`, wiki, media and settings pages are not supported and stop the run with an input error.
- User profile details such as karma breakdown or trophies are not scraped; users appear as people-search rows (username, karma, avatar) and through their post and comment feeds.
- User feeds are always newest first; **Subreddit sort** does not apply to them.
- Fields can be empty: `flair` depends on the subreddit, `language` is missing on some posts, `text` is null for link and media posts, and `upvoteRatio`, `postType`, `linkUrl` and `awardCount` are not available on post search rows.
- If Reddit blocks the main method for a subreddit feed or user posts, the actor reads them via RSS; those rows have no score, comment count, flair or NSFW flag, and the log says so.
- Banned, private, quarantined and nonexistent subreddits, and nonexistent or suspended users, return 0 rows with a warning naming the source.
- Reddit's page structure is undocumented and can change; a source that can no longer be read fails with a clear error while the other sources keep their rows.

### Tips and troubleshooting

- **Keep the residential proxy.** Reddit blocks most datacenter IPs; with another proxy the log warns and runs often fail.
- **Only new posts:** use `sort: "new"` with **Only posted after** — the feed stops at the first older post, so you pay only for new rows. With other sorts and with search, older rows are skipped while paging continues.
- **More comments:** raise **Max comments per post** (up to 5,000) and remember that every comment is a paid row and counts toward **Max results in total**.
- **Time range does nothing?** It applies only to Top and Controversial feeds and to post and comment searches; Hot, New, Rising and Best feeds ignore it with a warning, and so do communities and people searches.
- **0 rows from a subreddit?** Check the log: the subreddit may not exist, be banned, private or quarantined, or all its posts were NSFW (switch on **Include NSFW**) or older than your date filter.
- **includeComments has no effect** on communities and people searches or on `userContent: "comments"`, because those rows are not posts.

### API, MCP and integrations

Run the actor from your code with the same JSON input as in Console. Your API token is in [Console → Settings → API & Integrations](https://console.apify.com/settings/integrations).

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("genial_candlestand/reddit-posts-comments-scraper").call(run_input={
    "subreddits": ["programming"],
    "sort": "new",
    "maxItemsPerSource": 30,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**Node.js** (`npm install apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('genial_candlestand/reddit-posts-comments-scraper').call({
    "subreddits": ["programming"],
    "sort": "new",
    "maxItemsPerSource": 30,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**HTTP** — one request runs the actor and returns the results (runs up to 5 minutes; longer ones: [run asynchronously](https://docs.apify.com/api/v2/act-runs-post)):

```bash
curl -X POST "https://api.apify.com/v2/acts/genial_candlestand~reddit-posts-comments-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"subreddits":["programming"],"sort":"new","maxItemsPerSource":30}'
```

**AI agents (MCP).** Add the actor as a tool of the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Claude Code:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=genial_candlestand/reddit-posts-comments-scraper"
```

Claude Desktop, Cursor or VS Code: `{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=genial_candlestand/reddit-posts-comments-scraper"}}}`. Then ask, for example:

- "Get the newest posts from r/programming and r/de published in the last day"
- "Find Reddit comments from the past month that mention notion alternative, sorted by top"
- "Find subreddits about python with their member counts, descriptions and NSFW flags"

**Integrations.** Run it on a schedule with [Apify Schedules](https://docs.apify.com/platform/schedules) and send the results to Google Sheets, Slack, Zapier, Make, n8n or your webhook — see [Apify integrations](https://docs.apify.com/platform/integrations).

### FAQ

**Do I need a Reddit account or API key?**<br>
No. The actor reads only public pages without a login, an account or a developer token.

**Can I get every comment of a large thread?**<br>
The actor follows Reddit's "more comments" links, top-level and nested, until **Max comments per post** is reached (up to 5,000 per post). Each comment is its own row with `parentId` and `depth`.

**How is it different from other Reddit actors?**<br>
It returns all four row types (posts, comments, subreddits, users) with one price per row, searches posts, comments, communities and people, and can search inside one subreddit. Banned or private sources give no placeholder rows and cost nothing. It charges no extra start fee beyond Apify's default start event; the most-used Reddit actor in the Store charges $4.00 per 1,000 results.

**What happens if one source fails?**<br>
Each source runs on its own. A failed subreddit, search or user becomes a warning in the log and the run keeps the rows of the other sources.

**Is it legal to scrape Reddit?**<br>
The actor collects only publicly visible data, the same a logged-out visitor sees. It does not log in or bypass access controls. Reddit content can include personal data such as usernames; you are responsible for using the data in line with Reddit's terms, data-protection laws such as the GDPR, and your local regulations.

### Also useful

- [YouTube Comments Scraper](https://apify.com/genial_candlestand/youtube-comments-and-replies-scraper) — compare Reddit threads with YouTube comments and replies: text, likes, reply counts and dates
- [Google Search Scraper](https://apify.com/genial_candlestand/google-search-results-scraper) — find which pages and Reddit threads rank on Google for the same keywords
- [Google Trends Scraper](https://apify.com/genial_candlestand/google-trends-scraper) — check whether a topic discussed on Reddit is rising in Google search interest
- [Google News Scraper](https://apify.com/genial_candlestand/google-news-articles-search-scraper) — add news coverage of the same topic: titles, sources and publish times
- [Trustpilot Reviews Scraper](https://apify.com/genial_candlestand/trustpilot-reviews-scraper) — add customer reviews of the brand you track: ratings, text and company replies

# Actor input Schema

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

Any reddit.com URLs: a subreddit (https://www.reddit.com/r/programming/top/?t=week), a post (…/r/x/comments/abc123/slug/ — the post and its comments), a user (…/user/spez/ or …/user/spez/comments/) or a search (…/search/?q=rust\&type=comments, …/r/rust/search/?q=async). Sort, time and type in the URL override the fields below. old., np., m. and new.reddit.com hosts are accepted. Short redd.it links and r/all, r/popular are not supported.

## `queries` (type: `array`):

Keywords to search on Reddit, one per line. What is searched is set by 'Search for' (posts, comments, communities or people); 'Search sort', 'Time range' and 'Search inside subreddit' refine it. Example: rust async.

## `searchType` (type: `string`):

What the search terms return: posts, comments, communities (subreddits) or people (users). Applies only to 'Search terms'.

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

Order of search results for posts and comments. Not applied to communities and people searches (Reddit orders them by relevance).

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

Optional subreddit name (without r/) to limit post and comment searches to it, e.g. rust. Works only with 'Search for' = Posts or Comments; with Communities or People the run stops with an input error.

## `subreddits` (type: `array`):

Subreddit names (without r/) whose feed to scrape, one per line, e.g. programming. The feed order is set by 'Subreddit sort'. r/all and r/popular are not supported.

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

Order of subreddit feeds. 'Time range' applies only to Top and Controversial. User feeds are always newest first.

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

Period for subreddit feeds sorted by Top or Controversial and for post and comment searches. Ignored (with a log warning) for Hot, New, Rising and Best feeds. Empty = Reddit's own default (past day for Top feeds, all time for search).

## `users` (type: `array`):

Reddit usernames (without u/) whose activity to scrape, one per line, e.g. spez. What is scraped is set by 'User content'.

## `userContent` (type: `string`):

Which feed of each user: their posts, their comments, or both mixed (overview). Always newest first.

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

Also scrape the comment thread of every post found in subreddit feeds, user feeds and post searches (up to 'Max comments per post' each). Every comment is its own row and a paid result. Post URLs always get their comments.

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

Most comments to scrape per post (top-level and replies, in the order of 'Comment sort'). Applies to post URLs and to 'Add comments of every post'. 0 = only the post row of a post URL.

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

Order of comments in a thread; decides which comments are kept when 'Max comments per post' cuts the thread.

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

Keep only posts and comments published after this date: an absolute date (2026-01-31) or a relative one (7 days, 12 hours). Older rows are skipped for free. Not applied to communities and people.

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

Keep posts and communities marked NSFW (over 18). Off: they are skipped for free and the log says how many.

## `maxItemsPerSource` (type: `integer`):

Most posts, search results or user items per source (one URL, search term, subreddit or user). Comments are limited separately by 'Max comments per post'. Reddit lists end at about 1000 items.

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

Stop the whole run after this many rows (posts, comments, communities and users together). Every row is one paid result.

## `proxyConfiguration` (type: `object`):

Reddit blocks most datacenter IPs; keep the residential proxy (default). Other proxies work only rarely and the log warns.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/programming/comments/1xqz3rf/the_day_after_code_is_already_here_this_is_what/"
    }
  ],
  "queries": [
    "web scraping"
  ],
  "searchType": "posts",
  "searchSort": "relevance",
  "subreddits": [
    "programming"
  ],
  "sort": "hot",
  "userContent": "posts",
  "includeComments": false,
  "maxCommentsPerPost": 100,
  "commentSort": "best",
  "includeNsfw": false,
  "maxItemsPerSource": 100,
  "maxItems": 1000,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

Dataset with all rows (posts, comments, subreddits, users)

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

Overview table of all rows

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/programming/comments/1xqz3rf/the_day_after_code_is_already_here_this_is_what/"
        }
    ],
    "queries": [
        "web scraping"
    ],
    "subreddits": [
        "programming"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("genial_candlestand/reddit-posts-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 = {
    "startUrls": [{ "url": "https://www.reddit.com/r/programming/comments/1xqz3rf/the_day_after_code_is_already_here_this_is_what/" }],
    "queries": ["web scraping"],
    "subreddits": ["programming"],
}

# Run the Actor and wait for it to finish
run = client.actor("genial_candlestand/reddit-posts-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/programming/comments/1xqz3rf/the_day_after_code_is_already_here_this_is_what/"
    }
  ],
  "queries": [
    "web scraping"
  ],
  "subreddits": [
    "programming"
  ]
}' |
apify call genial_candlestand/reddit-posts-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,genial_candlestand/reddit-posts-comments-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/es7kVWlRVTEXrEWz4/builds/5JL0MoUcZ5tp8psSb/openapi.json
