# Substack Scraper | Posts & Comments | $0.25 / 1K (`hridayrungta/substack-scraper`) Actor

Extract every post and comment from any Substack publication via its own public API - no login, no browser needed. Full article HTML, wordcount, reactions, restacks, nested comment threads. Incremental mode returns only new posts. $0.25/1K posts, $0.12/1K comments - beats typical market rates.

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

## Pricing

from $1.70 / 1,000 actor starteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Substack Scraper | Posts & Comments

Extracts posts and comment threads from any Substack publication using the publication's own public API — the same one its website calls to render the archive page. No login, no API key, no browser, no proxy.

### What you get

- **Full posts**: title, subtitle, slug, type, audience (free/paid), wordcount, description, full body HTML, cover image, publish date, comment count, reactions, restacks, canonical URL.
- **Comments**: nested replies with depth, author name/handle, score, timestamp. Deleted comments are marked, with body and author redacted.
- **Incremental mode**: track one or many publications over time. Each run after the first returns only posts published since the last run — no re-scraping, no re-paying for old data.

### How this works (honestly)

Substack publications run on a standard, stable (if undocumented) REST API at `<publication>.substack.com/api/v1/...`. This Actor calls that API directly:

1. Fetches the publication's archive, newest-first.
2. For each post you'll actually receive, fetches the full post (the archive listing doesn't include body HTML).
3. Optionally fetches and walks the comment tree for that post.

No headless browser, no residential proxy, no Cloudflare fight — because there isn't one. This also means it's fast and cheap, and that cost is passed on to you.

### Incremental mode

Set `mode: "changes"`. On the first run per publication, it seeds from `firstRunSince` (default 14 days back). Every run after that resumes exactly where the last one left off, tracked per publication in a key-value store. A run that's cut short by your `maxItems` budget still advances the mark safely — you'll never get duplicate rows on the next run, and you'll never silently skip a post either.

### Input at a glance

| Field | Description |
|---|---|
| `publications` | Required. One or more Substack URLs or subdomains (e.g. `"platformer"` or `"https://platformer.substack.com"`). |
| `mode` | `"all"` (default) or `"changes"` (incremental). |
| `includeComments` | Fetch comment threads for each post. Default `true`. |
| `maxCommentDepth` | How deep into nested replies to go. |
| `maxItems` | Budget cap on billed rows for this run. |
| `firstRunSince` | How far back the first incremental run looks (e.g. `"14 days"`). |

### Billing (pay-per-event)

| Event | Price |
|---|---|
| Actor started | $0.0017 — charged once per run, regardless of results |
| Post scraped | $0.00025 ($0.25 / 1,000) |
| Comment scraped | $0.00012 ($0.12 / 1,000) |

No hidden per-GB proxy costs, no separate "with content" tier — every post you're charged for already includes the full body HTML.

# Actor input Schema

## `publications` (type: `array`):

Substack publications, one per line: a bare subdomain ("platformer"), a full ".substack.com" host, or a custom domain the publication uses.

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

Fetch every post's full comment thread too, flattened with depth and parent id.

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

How deep into a reply chain to go. 0 is top-level comments only.

## `mode` (type: `string`):

"all": every matching post, every run. "changes": only posts new since your last run, per publication.

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

Cost cap - you're billed once per row saved, posts and comments together.

## `firstRunSince` (type: `string`):

A publication's first incremental run only takes posts since this date/span - never its whole archive. Default "30 days"; "all" for a deliberate backfill.

## `maxRetries` (type: `integer`):

Retries with backoff for network errors and 5xx responses.

## `stateStoreName` (type: `string`):

Name of the key-value store (in YOUR account) that holds the high-water mark per publication. Leave blank for the default.

## `stateNamespace` (type: `string`):

Advanced: an explicit namespace for the mark key. Leave blank to namespace by your Apify user id automatically.

## Actor input object example

```json
{
  "publications": [
    "platformer.substack.com"
  ],
  "includeComments": false,
  "maxCommentDepth": 5,
  "mode": "all",
  "maxItems": 100,
  "firstRunSince": "30 days",
  "maxRetries": 3,
  "stateStoreName": "",
  "stateNamespace": ""
}
```

# Actor output Schema

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

No description

# 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 = {
    "publications": [
        "platformer.substack.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hridayrungta/substack-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 = { "publications": ["platformer.substack.com"] }

# Run the Actor and wait for it to finish
run = client.actor("hridayrungta/substack-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 '{
  "publications": [
    "platformer.substack.com"
  ]
}' |
apify call hridayrungta/substack-scraper --silent --output-dataset

```

## MCP server setup

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