# Substack Scraper — Posts, Engagement & Paywall API (`cleanrows/substack-posts-scraper`) Actor

Scrape any Substack publication's full archive with engagement flattened into numbers: reactions, comments, restacks, word count and free-vs-paid status. Gets the whole archive, not just the first page.

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

## Pricing

$4.00 / 1,000 post scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

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

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Substack Scraper — posts, engagement and paywall status in one schema

Scrape any Substack publication's **full archive** with engagement already turned
into numbers: reactions, comments, restacks, word count, and whether each post sits
behind the paywall.

### Why this one

**It gets the whole archive.** Substack's archive endpoint returns 23 posts on the
first page however large a limit you ask for, and 50 on every page after it. A
scraper that treats "fewer than requested" as the end of the data stops at 23 and
reports that as an entire publication. This pages until the archive actually ends —
verified past 573 posts on a single publication.

**Reactions come back as a number.** Substack returns them keyed by emoji:
`{"❤": 21}`. That breaks CSV exports and forces you to guess which emoji a given
publication uses. You get `reactionCount` as an integer, plus `topReaction` if you
want the emoji.

**Custom domains survive.** The Free Press publishes from the `bariweiss` slug but
lives at `thefp.com`. `url` is the canonical one, so links actually work.

**Paywall status as a boolean.** `isPaid` instead of decoding `audience` values like
`only_paid` and `founding` yourself.

### Input

```json
{
  "publications": ["noahpinion", "platformer", "www.thefp.com"],
  "sort": "new",
  "audience": "all",
  "searchQuery": "",
  "postedWithinDays": 0,
  "maxItemsPerPublication": 100
}
```

Slugs, subdomains and custom domains all work: `noahpinion`,
`bariweiss.substack.com` and `www.thefp.com` are all valid.

### Output

One row per post:

```json
{
  "postId": "212192141",
  "publication": "www.thefp.com",
  "title": "'It's Just Dog Racism'",
  "subtitle": "'The myth of the pit bull is a lot of bullshit,' said actor Jon Bernthal.",
  "url": "https://www.thefp.com/p/its-just-dog-racism",
  "postDate": "2026-08-21T20:29:06.512Z",
  "type": "newsletter",
  "audience": "only_paid",
  "isPaid": true,
  "reactionCount": 21,
  "topReaction": "❤",
  "commentCount": 9,
  "restacks": 0,
  "wordCount": 2049,
  "sectionName": null
}
```

A `RUN_SUMMARY` record reports per-publication counts and any that could not be found.

### Who this is for

- **Newsletter operators** benchmarking their engagement against comparable publications
- **Media researchers** tracking what gets read, restacked and paywalled
- **Content teams** mining a niche's archive for topics that landed
- **Investors and analysts** sizing a publication before a deal

### Notes

- Reads Substack's **public archive API**. No login, no cookies, no CAPTCHA solving,
  no proxies.
- Post bodies are not included; this returns metadata and engagement.
- `maxItemsPerPublication` defaults to 100. Set it to 0 for the entire archive,
  which on a long-running publication can be thousands of posts.

# Actor input Schema

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

Substack slugs, subdomains or custom domains. `noahpinion`, `bariweiss.substack.com` and `www.thefp.com` all work.

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

Order requested from Substack.

## `audience` (type: `string`):

Filter by whether the post sits behind the paywall.

## `searchQuery` (type: `string`):

Keep only posts whose title, subtitle or description contains this text.

## `postedWithinDays` (type: `integer`):

Keep only posts published in the last N days. 0 disables the filter.

## `maxItemsPerPublication` (type: `integer`):

Stop after this many posts from each publication. 0 fetches the entire archive, which can run to thousands.

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

Stop after this many posts across all publications. 0 means no limit.

## Actor input object example

```json
{
  "publications": [
    "noahpinion",
    "www.thefp.com"
  ],
  "sort": "new",
  "audience": "all",
  "searchQuery": "",
  "postedWithinDays": 0,
  "maxItemsPerPublication": 100,
  "maxItems": 0
}
```

# Actor output Schema

## `posts` (type: `string`):

One row per post with engagement counts and paywall status.

## `runSummary` (type: `string`):

Per-publication counts and any that could not be found.

# 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": [
        "noahpinion",
        "platformer"
    ]
};

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

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

```

## MCP server setup

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