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

Get Reddit posts and full comment threads from subreddits, searches, user profiles and post links: titles, text, scores, flair, media and replies. New-post monitoring built in. No login.

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

## Pricing

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

### What does Reddit Scraper do?

**Reddit Scraper** gets posts and full comment threads from **subreddits, Reddit search, user profiles and post links**, as JSON, CSV or Excel: titles, text, authors, scores, upvote ratios, comment counts, flair, images, galleries, videos and links, plus every comment with its reply level and parent. Sort subreddits by **hot, new, top or rising**, search **all of Reddit or inside chosen subreddits**, and turn on **Only new posts** to get just the posts published since your last run.

No Reddit account, no API key and no app registration. The Actor reads Reddit the way a logged-out visitor's browser does.

### Why use this Reddit scraper?

- **Whole comment trees.** The Actor follows every "load more comments" and "more replies" link, so nested replies arrive with their `depth` and `parentId`. In our test on 20 hot threads of r/personalfinance it saved 1,854 comments down to reply level 10, and the parent of every reply was in the data.
- **Past Reddit's 1,000-post wall.** Reddit ends every listing after about 1,000 posts. Ask for more and the Actor goes on through the subreddit's other listings (top of all time, of the year, month and week, then new, hot and more), skipping posts it already has. Our test read 1,200 different r/AskReddit posts in one run.
- **Full posts from search too.** Search results come with the post text, flair, upvote ratio, media and links, the same fields as subreddit posts, not just titles.
- **Monitoring built in.** **Only new posts** remembers what each input returned before. Scheduled runs save and charge only posts you have not seen.
- **Fast.** 1,500 posts from three subreddits took 38 seconds in our tests; 1,200 posts from one subreddit took 60 seconds.
- **Proxies included.** Reddit refuses datacenter and cloud IPs, so the Actor uses Apify residential proxies by default and keeps the traffic small (about 3 KB per result). You pay only the price per result.
- **Never charges a row twice.** A restarted run skips rows it already saved, and the run stops exactly at the maximum cost you set.

Typical uses: brand and product mentions, market and audience research, finding leads who ask for a tool like yours, sentiment and topic analysis, collecting discussion data for AI and search pipelines, and tracking new posts in the communities you care about.

### What data can you get from Reddit?

Every row has `type`: `post` or `comment`.

| Field | Description |
| --- | --- |
| `id`, `url`, `permalink` | Reddit's id of the post or comment and its link |
| `subreddit` | Community name (`u_<name>` for posts on a user's profile) |
| `title`, `text` | Post title and body text (plain text, paragraphs kept); comment text |
| `author` | Username of the poster or commenter (`[deleted]` when the account is gone) |
| `createdAt`, `scrapedAt` | When it was posted and when it was saved (ISO 8601, UTC) |
| `score`, `upvoteRatio`, `numComments` | Votes, share of upvotes (posts) and number of comments (posts) |
| `flair` | Post flair, such as "Discussion" or "News" |
| `postType`, `domain`, `linkUrl` | Reddit's post kind (`text`, `multi_media` for text with pictures, `link`, `image`, `gallery`, `video`); the linked site and page |
| `images`, `videoUrl`, `thumbnailUrl` | Full-size images (galleries in order), the video stream and a preview image |
| `isNSFW`, `isSpoiler`, `isStickied`, `isLocked`, `isArchived`, `isCrosspost` | Post flags |
| `awardCount` | Awards, when Reddit shows them |
| `postId`, `parentId`, `depth` | Comments: the post, the comment replied to (the post's id for top-level comments) and the reply level (0 for top level) |
| `isSubmitter`, `postTitle` | Comments: whether the post's author wrote it, and the post's title |
| `sourceType`, `sourceInput` | Which input found the row: `subreddit`, `search`, `user` or `post`, and the input itself |

### How to scrape Reddit

1. Open the Actor and add **subreddits** (names like `technology` or links like `https://www.reddit.com/r/technology/top/?t=week`), **search queries**, **post links** or **users**. Mix them freely.
2. Pick the **subreddit sort** (new, hot, top, rising or controversial) and, for top, the **time window**. For search, pick the sort and time window, and optionally the subreddits to search in.
3. Set **Max posts per source**. Optionally set **Only posts newer than** a date or a span such as `7 days`.
4. Tick **Include comments** for comment threads, and set **Max comments per post** and **Max reply depth**.
5. For monitoring, tick **Only new posts** and add a schedule.
6. Click **Start**, then download the results as JSON, CSV, Excel or HTML, or read them through the API.

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

The Actor uses pay per event pricing, so you pay for results saved, not for server time or proxies:

- **Post or comment: $1.00 per 1,000** on Apify's free plan.
- Paid Apify plans pay less: **$0.80 per 1,000 on Starter, $0.60 on Scale and $0.50 on Business**.
- Each run also has a start fee of $0.002.

Example: **1,000 posts cost about $1.00.** 100 posts with up to 50 comments each is at most 5,100 results, so about $5.10. Watching 10 subreddits every hour with Only new posts, at about 5 new posts per subreddit per hour, is about 36,000 posts a month: $36 plus $1.44 in start fees on the free plan, $18 on Business. Posts skipped by Only new posts are free, and you can set a maximum cost per run in the run options; the Actor stops cleanly when it reaches it. Apify's free plan includes $5 of monthly credit, enough for about 5,000 results a month.

### Input

See the Input tab for every option. A typical input:

```json
{
    "subreddits": ["personalfinance", "https://www.reddit.com/r/investing/top/?t=week"],
    "sort": "hot",
    "searchQueries": ["index fund"],
    "searchSubreddits": ["personalfinance"],
    "searchSort": "new",
    "maxPostsPerSource": 100,
    "newerThan": "7 days",
    "includeComments": true,
    "maxCommentsPerPost": 200,
    "maxCommentDepth": 10
}
```

A user's posts and comments, or single posts by link:

```json
{
    "users": ["spez"],
    "userContent": "both",
    "postUrls": [
        "https://www.reddit.com/r/Python/comments/1x5caxn/jazzband_is_shutting_down/",
        "https://redd.it/1x8k0nn"
    ],
    "includeComments": true
}
```

For monitoring:

```json
{
    "subreddits": ["news"],
    "sort": "new",
    "maxPostsPerSource": 100,
    "onlyNewPosts": true
}
```

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. Three real results: a text post and one of its comments read from a post link, and an image post found by search. Long text is shortened with "...".

```json
[
    {
        "type": "post",
        "id": "1x5caxn",
        "url": "https://www.reddit.com/r/Python/comments/1x5caxn/jazzband_is_shutting_down/",
        "permalink": "/r/Python/comments/1x5caxn/jazzband_is_shutting_down/",
        "subreddit": "Python",
        "title": "Jazzband is shutting down",
        "text": "Jazzband was a collaborative community to share the responsibility of maintaining Python-based projects. And after 10 years of operation it is shutting down. The shutdown was announced in March and will continue later this year.\n\nOver 10 years ago, I started Jazzband as a cooperative experiment to reduce the stress of maintaining Open Source software...",
        "author": "nicholashairs",
        "createdAt": "2026-10-13T23:40:04.455Z",
        "score": 188,
        "upvoteRatio": 0.9607843137254902,
        "numComments": 23,
        "flair": "News",
        "isNSFW": false,
        "isSpoiler": false,
        "isStickied": false,
        "isLocked": false,
        "isArchived": false,
        "isCrosspost": false,
        "postType": "text",
        "domain": "self.Python",
        "linkUrl": null,
        "images": [],
        "videoUrl": null,
        "thumbnailUrl": null,
        "awardCount": null,
        "sourceType": "post",
        "sourceInput": "https://www.reddit.com/r/Python/comments/1x5caxn/jazzband_is_shutting_down/",
        "scrapedAt": "2026-10-18T06:45:23.647Z"
    },
    {
        "type": "comment",
        "id": "pgsta53",
        "postId": "1x5caxn",
        "parentId": "pgnjq4c",
        "depth": 1,
        "author": "nicholashairs",
        "text": "The Django Commons group seems like it's more successful and more stable - partly because it's not a one-man show.\n\nThere's also Opensource Endowment which overtime might bring some more financial stability to maintainers, particularly solo ones.",
        "createdAt": "2026-10-15T00:10:29.935Z",
        "score": 2,
        "isSubmitter": true,
        "url": "https://www.reddit.com/r/Python/comments/1x5caxn/comment/pgsta53/",
        "permalink": "/r/Python/comments/1x5caxn/comment/pgsta53/",
        "subreddit": "Python",
        "postTitle": "Jazzband is shutting down",
        "awardCount": null,
        "sourceType": "post",
        "sourceInput": "https://www.reddit.com/r/Python/comments/1x5caxn/jazzband_is_shutting_down/",
        "scrapedAt": "2026-10-18T06:45:24.811Z"
    },
    {
        "type": "post",
        "id": "1x6evac",
        "url": "https://www.reddit.com/r/mildlyinteresting/comments/1x6evac/bought_a_cheap_80_mechanical_keyboard_in_2026/",
        "permalink": "/r/mildlyinteresting/comments/1x6evac/bought_a_cheap_80_mechanical_keyboard_in_2026/",
        "subreddit": "mildlyinteresting",
        "title": "Bought a cheap 80% mechanical keyboard in 2026 that has an Internet Explorer logo on the F9 Key",
        "text": null,
        "author": "Bright-Aspect2724",
        "createdAt": "2026-10-15T07:04:03.605Z",
        "score": 1576,
        "upvoteRatio": 0.9781021897810219,
        "numComments": 115,
        "flair": null,
        "isNSFW": false,
        "isSpoiler": false,
        "isStickied": false,
        "isLocked": false,
        "isArchived": false,
        "isCrosspost": false,
        "postType": "image",
        "domain": "i.redd.it",
        "linkUrl": "https://i.redd.it/h26s1ce2ykvh1.png",
        "images": ["https://i.redd.it/h26s1ce2ykvh1.png"],
        "videoUrl": null,
        "thumbnailUrl": "https://preview.redd.it/h26s1ce2ykvh1.png?width=140&height=128&auto=webp&s=fc31517581b16f3a223d3d83dd6aabc1a3b9fd78",
        "awardCount": null,
        "sourceType": "search",
        "sourceInput": "mechanical keyboard",
        "scrapedAt": "2026-10-18T06:16:20.093Z"
    }
]
```

The **Posts** and **Comments** views in the Output tab show each kind on its own; in the API add `view=comments` to the dataset items URL for comments only.

### How Only new posts works

With **Only new posts** on, the Actor keeps the ids of the posts it saved for an input in the key-value store `reddit-scraper-monitor` in your account, and later runs with the same inputs skip them, along with their comments. Each set of inputs gets its own list; give a **Monitor name** to keep separate lists for schedules with the same inputs. Use the **new** sort for monitoring, and set **Max posts per source** a little above the number of posts a subreddit gets between runs. Skipped posts cost nothing.

### Tips for scraping Reddit

- **More than 1,000 posts from a subreddit.** Set **Max posts per source** above 1,000 and leave **Only posts newer than** empty: when the chosen listing ends, the Actor reads the subreddit's other listings and skips duplicates. How far it gets depends on the subreddit; small communities run out of posts first.
- **Comments cost per comment.** Big threads have thousands. Use **Max comments per post** (comments are read in Reddit's "best" order, shallow replies before deep ones) and **Max reply depth** to keep only what you need.
- **Fewer comments than `numComments`?** Reddit's count includes removed and deleted comments. Removed ones are not shown at all, and a deleted one shows only as an empty placeholder without its id or text, so neither becomes a row. On the threads we checked, the Actor saved exactly the comments the page shows.
- **Search like on Reddit.** Queries accept Reddit's search operators, such as `author:spez` or `title:keyboard`. Use **Search only in these subreddits** to search inside communities.
- **Dates.** **Only posts newer than** takes a date (`2026-10-01`) or a span (`24 hours`, `7 days`). With the new sort the Actor stops at the first older post, so dated runs are quick.
- **Proxies.** Leave the default residential proxy on: Reddit blocks datacenter IPs. Use your own proxies only if they are residential or mobile.

### Integrations and API

- **API:** start runs and read results with the [Apify API](https://docs.apify.com/api/v2), for example `POST https://api.apify.com/v2/acts/stratumics~reddit-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input as the JSON body.
- **JavaScript and Python:** use the official `apify-client` packages: `client.actor('stratumics/reddit-scraper').call(input)`, then read `client.dataset(run.defaultDatasetId).listItems()`.
- **No-code:** connect the Actor to Zapier, Make, n8n, Google Sheets, Slack or webhooks from the Integrations tab, for example to send each new post that mentions your brand to a Slack channel.
- **AI agents:** add the Apify MCP server (`https://mcp.apify.com?tools=stratumics/reddit-scraper`) to any assistant that supports the Model Context Protocol, and it can read Reddit threads and searches on its own.

### FAQ

#### Do I need a Reddit account or API key?

No. The Actor reads public Reddit pages without logging in, so there is no API key, OAuth app or rate limit of yours to manage.

#### Can it read private, quarantined or NSFW communities?

No. Reddit shows those only to logged-in users, so the Actor skips them and names them in the run's status message. Search returns what Reddit shows a logged-out visitor.

#### Why does a user profile return fewer posts than I expected?

The Actor reads a profile the way Reddit's own profile page lists it, newest first, and stops where Reddit's list ends. Posts the user deleted, and posts Reddit hides from profiles, are not there.

#### How do I get only new posts every day?

Tick **Only new posts**, use the new sort, and add a daily or hourly schedule in the Schedules tab. Each run returns only posts the earlier runs did not.

#### Is it legal to scrape Reddit?

Our Actors are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.

Results contain Reddit usernames and what people wrote publicly, the same as anyone sees on the site. The Actor does not collect anything else about the people behind them.

#### Where do I report a problem?

Open an issue on the Issues tab with your run link and we will look at it. For programmatic access, see the API tab.

### Other tools from Stratum ICS

- [Airbnb Scraper](https://apify.com/stratumics/airbnb-scraper): Get every Airbnb listing in a city or from listing links: price per night, rating, reviews, guests, bedrooms, host and Superhost status.
- [App Store Reviews Scraper](https://apify.com/stratumics/app-store-reviews-scraper): Get Apple App Store reviews with star ratings, titles, text, app versions, helpful votes and developer replies, well past Apple's 500-review limit, for any country, plus app ratings.
- [Bilibili Scraper](https://apify.com/stratumics/bilibili-scraper): Scrape Bilibili videos by search, link or uploader without logging in: views, likes, coins, tags, uploader profiles, comments with replies and danmaku, in clean rows.
- [Facebook Ads Library Scraper](https://apify.com/stratumics/facebook-ads-library-scraper): Get ads from the Meta (Facebook) Ad Library by keyword, advertiser page or library link: texts, images, videos, dates, platforms and versions, plus spend for political ads.
- [Facebook Posts Scraper](https://apify.com/stratumics/facebook-posts-scraper): Get posts from public Facebook pages: text, reactions by type, comments, shares, views and media, plus page details with followers, contacts, rating and creation date.
- [Google Ads Transparency Scraper](https://apify.com/stratumics/google-ads-transparency-scraper): Get the ads any advertiser runs on Google Search, YouTube, Shopping, Maps and Play, from the Ads Transparency Center: images, formats, dates, regions and EU reach.
- [Google Maps Reviews Scraper](https://apify.com/stratumics/google-maps-reviews-scraper): Get the Google Maps reviews of any place: rating, full text, exact date, photos, owner reply, reviewer details and food or service scores.
- [Google Maps Scraper](https://apify.com/stratumics/google-maps-scraper): Get the businesses on Google Maps for any search and area: name, address, phone, website, rating, review count, opening hours, plus emails and social profiles.
- [Google News Scraper](https://apify.com/stratumics/google-news-scraper): Get Google News articles with real publisher URLs (not Google redirects), source, date, image, author and optional full text.
- [Google Play Reviews Scraper](https://apify.com/stratumics/google-play-reviews-scraper): Get Google Play reviews with star ratings, text, app versions, thumbs-up counts, developer replies and feature ratings in any language, plus app details with installs and star histogram.
- [Google Trends Scraper](https://apify.com/stratumics/google-trends-scraper): Get Google Trends data as JSON, CSV or Excel: interest over time, interest by region and city, related queries, and trending searches by country.
- [Instagram Scraper](https://apify.com/stratumics/instagram-scraper): Scrape public Instagram profiles, posts, reels and comments without logging in: followers, bio, posts count, captions, likes, video views, media links, tags and music.
- [LinkedIn Jobs Scraper](https://apify.com/stratumics/linkedin-jobs-scraper): Scrape LinkedIn jobs with full descriptions, salary ranges, seniority, job type and applicant counts.
- [Telegram Channel Scraper](https://apify.com/stratumics/telegram-channel-scraper): Get messages from public Telegram channels with views, dates, media, reactions, polls and forwards, plus channel info with exact subscriber counts.
- [Threads Scraper](https://apify.com/stratumics/threads-scraper): Scrape Threads profiles, posts, replies and keyword search: followers, bio, post text, likes, replies, reposts, quotes, media and links.
- [TikTok Comments Scraper](https://apify.com/stratumics/tiktok-comments-scraper): Export TikTok comments and replies from any video or photo post: text, date, likes, reply count, commenter, pinned and creator-liked flags, plus video stats.
- [TikTok Scraper](https://apify.com/stratumics/tiktok-scraper): Scrape TikTok profiles and videos: followers, likes, bio, the latest 10 to 12 videos of each profile, and full stats for any video link.
- [Website Contact Scraper](https://apify.com/stratumics/website-contact-scraper): Turn a list of websites into one row per company with verified emails, formatted phone numbers, social profiles (LinkedIn, Facebook, Instagram, X), address and contact page.
- [YouTube Scraper](https://apify.com/stratumics/youtube-scraper): Get YouTube videos from searches, channels, playlists and links with exact views, likes, comment counts, dates and tags, plus channel profiles and comments.
- [YouTube Transcript Scraper](https://apify.com/stratumics/youtube-transcript-scraper): Get YouTube transcripts and captions as plain text, timed segments, SRT or WebVTT, from video links, whole channels or playlists, in any language YouTube offers.

# Actor input Schema

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

Subreddit names (technology, r/technology) or links (https://www.reddit.com/r/technology/top/?t=week). A link keeps its own sort and time window.

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

Order of subreddit posts. New lists the newest first.

## `timeWindow` (type: `string`):

Period Top and Controversial rank posts over. Other sorts ignore it.

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

Words to search Reddit posts for, as you would type them in Reddit's search box.

## `searchSubreddits` (type: `array`):

Optional. Each query runs once in each of these subreddits. Leave empty to search all of Reddit.

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

Order of search results.

## `searchTimeWindow` (type: `string`):

Period searched.

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

Links to single posts (https://www.reddit.com/r/AskReddit/comments/1x8gese/... or https://redd.it/1x8gese).

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

Usernames (spez, u/spez) or profile links.

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

Which part of each user's profile to read.

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

Posts to read from each subreddit, search, user or link (for user comments: comments to read). 0 reads up to 10,000. Reddit ends a listing after about 1,000 posts; see the README for ways around it.

## `newerThan` (type: `string`):

Optional. A date (2026-10-01) or a span back from now (7 days). Older posts are skipped, and newest-first listings stop there.

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

Also save the comments of each post, as separate rows with their reply level and parent. Each comment is charged as one result.

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

Comments to save per post, top-level ones first. 0 saves up to 10,000.

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

Deepest reply level to save: 0 saves top-level comments only, 1 adds direct replies, and so on.

## `onlyNewPosts` (type: `boolean`):

Save only posts earlier runs with the same inputs have not returned (and their comments). The Actor remembers post ids in the key-value store reddit-scraper-monitor in your account. Pair it with a schedule.

## `monitorName` (type: `string`):

Optional. A name for the remembered list, so different schedules keep separate histories even with the same inputs. Leave empty to derive it from the inputs.

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

Reddit blocks datacenter and cloud IPs, so the Actor uses Apify residential proxies (US) by default, at no extra charge to you. Change this only to use your own proxies.

## Actor input object example

```json
{
  "subreddits": [
    "technology"
  ],
  "sort": "new",
  "timeWindow": "day",
  "searchQueries": [],
  "searchSubreddits": [],
  "searchSort": "relevance",
  "searchTimeWindow": "all",
  "postUrls": [],
  "users": [],
  "userContent": "posts",
  "maxPostsPerSource": 20,
  "includeComments": false,
  "maxCommentsPerPost": 100,
  "maxCommentDepth": 10,
  "onlyNewPosts": false,
  "monitorName": "",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `rows` (type: `string`):

Dataset with one row per post or comment.

## `comments` (type: `string`):

Comment rows with their reply level and parent.

# 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 = {
    "subreddits": [
        "technology"
    ],
    "maxPostsPerSource": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("stratumics/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 = {
    "subreddits": ["technology"],
    "maxPostsPerSource": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("stratumics/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 '{
  "subreddits": [
    "technology"
  ],
  "maxPostsPerSource": 20
}' |
apify call stratumics/reddit-scraper --silent --output-dataset

```

## MCP server setup

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