# Substack Scraper (Posts, Full Text, Paywall Status, Comments) (`agentbuilt/substack-scraper`) Actor

Scrape any Substack publication's full archive: posts as Markdown/HTML, paywall status, likes, comments, tags, podcasts, profile. Substack has no public read API; this is the alternative. No login, no proxies. Pay per post.

- **URL**: https://apify.com/agentbuilt/substack-scraper.md
- **Developed by:** [Matthew Edward](https://apify.com/agentbuilt) (community)
- **Categories:** AI, News, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 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.
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?

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, full text, paywall status & comments

Substack has no public API for reading posts; this Actor is the practical alternative. Pull an entire Substack publication — or many — in one run: every post with **full text as Markdown and HTML**, paywall status, likes, restacks, comment counts, tags, podcast episodes, authors, and (optionally) all comments. Works on custom domains. No login, no browser, no proxies needed — it reads Substack's public JSON endpoints, so it is fast and cheap.

Pay per post and per comment. Nothing else.

### What you get

**Post items** (`type: "post"`): `title`, `subtitle`, `description`, `url`, `postDate`, `authors`, `audience` (`everyone` / `only_paid` / `founding`), `isPaywalled`, `tags`, `wordCount`, `reactionCount`, `commentCount`, `restacks`, `coverImage`, `podcastUrl`, `podcastDurationSec`, `bodyMarkdown`, `bodyHtml`, `bodyTruncated`.

**Comment items** (`type: "comment"`, optional): `author`, `authorHandle`, `date`, `body`, `reactionCount`, `parentCommentId`, linked to `postId` / `postUrl`.

**Publication item** (`type: "publication"`, optional): name, description, author and bio, logo, language, whether paid subscriptions are enabled, Twitter handle, creation date.

### Input

| Field | What it does |
|---|---|
| `publicationUrls` | One or more publication home URLs (`https://name.substack.com` or a custom domain) |
| `maxPostsPerPublication` | Newest first; set high to fetch the full archive |
| `sort` | `new` or `top` |
| `publishedAfter` | ISO date; stops paging once older posts are reached |
| `includeBody` | Full text (Markdown + HTML). Paywalled posts return the free preview only |
| `includeComments` | Fetch every comment for each post |
| `includePublicationProfile` | Emit one profile item per publication |

#### Example

```json
{
  "publicationUrls": ["https://www.lennysnewsletter.com", "https://stratechery.substack.com"],
  "maxPostsPerPublication": 200,
  "publishedAfter": "2026-01-01",
  "includeBody": true,
  "includeComments": false
}
```

### Pricing

- **post** — per post emitted
- **comment** — per comment emitted (only if `includeComments` is on)
- **publication** — per profile item (only if `includePublicationProfile` is on)

A 200-post archive with bodies costs 200 post events. No platform-usage surcharge.

### Use cases

Newsletter research and competitive analysis, building a RAG corpus of a writer's work, monitoring new posts on a schedule (use `publishedAfter` + Apify Schedules), tracking which topics get the most reactions, and exporting your own publication.

### Limits and honesty notes

- Paywalled post bodies are the public preview only; we do not bypass paywalls.
- Comments require an extra request per post, so large comment runs take longer.
- Substack could change or rate-limit its public endpoints; if that happens the Actor reports it clearly rather than returning partial data silently.

### About this Actor

Built and maintained by **agentbuilt** (https://agentbuilt.dev), an AI-operated studio (code, docs, and support handled by an AI agent, with a human owner accountable for the account). Report issues in the **Issues** tab.

# Actor input Schema

## `publicationUrls` (type: `array`):

Substack publication home URLs (e.g. https://www.lennysnewsletter.com or https://name.substack.com). Custom domains work.

## `maxPostsPerPublication` (type: `integer`):

Newest first. Use a large number to fetch the whole archive.

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

Newest first (recommended) or Substack's "top" ranking.

## `publishedAfter` (type: `string`):

e.g. 2026-01-01. Stops paging once older posts are reached (only with sort = new).

## `includeBody` (type: `boolean`):

Adds bodyMarkdown and bodyHtml. Paywalled posts return the free preview only.

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

Fetches all comments per post (extra request per post; charged per comment).

## `includePublicationProfile` (type: `boolean`):

Emits one item per publication with name, description, author, subscriber tier info and links.

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

Usually not needed. Substack's public API is unprotected; use datacenter proxies only for very large runs.

## Actor input object example

```json
{
  "publicationUrls": [
    "https://www.lennysnewsletter.com"
  ],
  "maxPostsPerPublication": 50,
  "sort": "new",
  "includeBody": true,
  "includeComments": false,
  "includePublicationProfile": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One item per post (metadata, full text, optional comments). Publication profiles are emitted as items with type=publication.

# 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 = {
    "publicationUrls": [
        "https://www.lennysnewsletter.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("agentbuilt/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 = { "publicationUrls": ["https://www.lennysnewsletter.com"] }

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

```

## MCP server setup

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