# Substack Scraper (`parsebird/substack-scraper`) Actor

Scrape any Substack newsletter — posts with full HTML content, nested comments, and publication metadata including subscriber counts. Unlimited archive depth, custom domains, keyword discovery. Export JSON, CSV, Excel.

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

## Pricing

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

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

Extract data from any Substack newsletter — posts with full HTML content, comments with nested replies, and publication metadata including subscriber counts. Unlimited archive depth (no 12-post cap), works with both `*.substack.com` and custom-domain newsletters. Uses Substack's public JSON API — no browser, no proxy.

<table><tr>
<td style="border-left:4px solid #FF6719;padding:12px 16px;font-weight:600">Scrape full post HTML, engagement metrics, threaded comments, author details and publication subscriber counts from any Substack — by URL or by keyword. Filter by type, date, and paywall status. Export JSON, CSV, Excel.</td>
</tr></table>

<br>

<table>
<tr>
<td colspan="2" style="padding:10px 14px;background:#FF6719;border:none;border-radius:4px 4px 0 0">
<span style="color:#FFFFFF;font-size:14px;font-weight:700;letter-spacing:0.5px">ParseBird Substack Suite</span>
<span style="color:#FFD4B8;font-size:13px">&nbsp;&nbsp;&bull;&nbsp;&nbsp;Newsletter intelligence at scale</span>
</td>
</tr>
<tr>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-radius:0 0 0 4px;border-right:none;border-top:none;vertical-align:top;width:50%;background:#FFF7ED">
📰 &nbsp;<a href="https://apify.com/parsebird/substack-scraper" style="color:#FF6719;text-decoration:none;font-weight:700;font-size:13px">Substack Scraper</a><br>
<span style="color:#FF6719;font-size:11px;font-weight:600">&#10148; You are here</span>
</td>
<td style="padding:10px 14px;border:1px solid #E7E5E4;border-radius:0 0 4px 0;border-top:none;vertical-align:top;width:50%;background:#FFFFFF">
🏆 &nbsp;<a href="https://apify.com/parsebird/substack-leaderboard-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Leaderboard Scraper</a><br>
<span style="color:#78716C;font-size:11px">Top bestseller & rising newsletters by category</span>
</td>
</tr>
</table>

##### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start using this actor.

```
Apify Actor: parsebird/substack-scraper — scrapes Substack newsletters via the public JSON API (no browser/proxy). Call: ApifyClient("TOKEN").actor("parsebird/substack-scraper").call(run_input={"urls": ["https://www.lennysnewsletter.com"], "keywords": ["artificial intelligence"], "maxPostsPerNewsletter": 20, "includeContent": true, "includeComments": false, "maxCommentsPerPost": 0, "includePublicationInfo": true, "contentType": "all", "onlyFree": false, "startDate": "2024-01-01", "endDate": "2026-12-31"}). Inputs: urls (array — homepage / custom domain / /archive / .../p/slug post URL), keywords (array — discover newsletters by topic), maxSearchResultsPerKeyword (int, default 20, max 100), maxPostsPerNewsletter (int, default 100, 0 = full archive), includeContent (bool, default true), includeComments (bool, default false), maxCommentsPerPost (int, default 0 = all), includePublicationInfo (bool, default true), contentType (all|newsletter|podcast|thread), onlyFree (bool), startDate/endDate (YYYY-MM-DD). Output: `default` dataset = posts (postId, title, url, publishedAt, updatedAt, postType, isPaid, wordcount, bodyHtml, truncatedBodyText, tags, reactionCount, commentCount, restacks, authorName/Handle, publicationName, subscriberCount, comments[] with nested replies); `publications` dataset = newsletter metadata. API docs: https://docs.apify.com/api/v2  Token: https://console.apify.com/settings/integrations
```

### What does Substack Scraper do?

Give it newsletter URLs, keywords, or both. It walks each newsletter's archive through Substack's public API and returns a structured record per post.

**Per post:**

- **Identity** — `postId`, `title`, `subtitle`, `slug`, canonical `url`
- **Timestamps** — `publishedAt`, `updatedAt`
- **Type & paywall** — `postType` (newsletter / podcast / thread), `audience`, `isPaid`
- **Content** — `bodyHtml` (full HTML for free posts), `truncatedBodyText` (preview for every post), `wordcount` (even for paid)
- **Media** — `coverImage`, `podcastUrl`, `podcastDuration`, `hasVoiceover`
- **Engagement** — `reactionCount`, `commentCount`, `childCommentCount`, `restacks`
- **Author** — `authorName`, `authorHandle`, `authorBio`, `authorPhotoUrl`, `authorId`
- **Publication** — `publicationName`, `publicationId`, `publicationUrl`, `subscriberCount`
- **Comments** (optional) — full nested threads: `id`, `body`, `date`, `editedAt`, `name`, `handle`, `photoUrl`, `reactionCount`, `restacks`, `isAuthor`, `isPinned`, `replies[]`

**Per publication** (`publications` dataset): `id`, `name`, `subdomain`, `customDomain`, `baseUrl`, `authorName`, `authorHandle`, `authorBio`, `authorPhotoUrl`, `logoUrl`, `heroText`, `language`, `paymentsEnabled`, `subscriberCount`, `monthlyPrice`, `annualPrice`.

### Input parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `urls` | array | `[]` | Newsletter URLs — homepage, custom domain, `/archive`, or a single post URL. |
| `keywords` | array | `[]` | Topics to discover newsletters across public Substack. |
| `maxSearchResultsPerKeyword` | integer | `20` | Matching posts to process per keyword (max 100). |
| `maxPostsPerNewsletter` | integer | `100` | Max posts per newsletter, newest first. `0` = full archive. |
| `includeContent` | boolean | `true` | Include the full HTML body. Disable for metadata-only (faster, cheaper). |
| `includeComments` | boolean | `false` | Fetch comments for each post. One extra API call per post. |
| `maxCommentsPerPost` | integer | `0` | Cap top-level comment threads per post (`0` = all). Replies always included. |
| `includePublicationInfo` | boolean | `true` | Emit newsletter metadata to the `publications` dataset. |
| `contentType` | select | `all` | `all`, `newsletter`, `podcast`, or `thread`. |
| `onlyFree` | boolean | `false` | Only include free posts. |
| `startDate` / `endDate` | string | — | Only posts within this date range (YYYY-MM-DD). |

### Output example

```json
{
  "postId": 186226252,
  "title": "How to build AI product sense",
  "subtitle": "The secret is using Cursor for non-technical work",
  "slug": "how-to-build-ai-product-sense",
  "url": "https://www.lennysnewsletter.com/p/how-to-build-ai-product-sense",
  "publishedAt": "2026-02-03T13:45:58.303Z",
  "updatedAt": "2026-05-16T03:04:37.084Z",
  "postType": "newsletter",
  "audience": "everyone",
  "isPaid": false,
  "wordcount": 5867,
  "coverImage": "https://substackcdn.com/image/fetch/...",
  "tags": ["AI"],
  "reactionCount": 298,
  "commentCount": 31,
  "childCommentCount": 15,
  "restacks": 20,
  "hasVoiceover": false,
  "bodyHtml": "<div class=\"body markup\">...</div>",
  "truncatedBodyText": "👋 Hey there, I'm Lenny...",
  "authorName": "Tal Raviv",
  "authorHandle": "talsraviv",
  "publicationName": "Lenny's Newsletter",
  "subscriberCount": "1,200,000",
  "comments": [
    {
      "id": 209331673,
      "body": "This article creates a whole new paradigm for learning...",
      "date": "2026-02-03T15:34:25.318Z",
      "name": "Jack Cohen",
      "handle": "jackcohen10",
      "reactionCount": 9,
      "isAuthor": false,
      "replies": [
        { "id": 209340123, "body": "Thanks Jack!", "name": "Tal Raviv", "isAuthor": true, "replies": [] }
      ]
    }
  ],
  "scrapedAt": "2026-02-06T02:07:09.750Z"
}
```

### Use cases

- **Content archival** — back up an entire newsletter, including update history and word counts
- **Competitive research** — track a competitor's posting cadence, topics, and engagement
- **Audience analysis** — mine comment threads for sentiment, questions, and top contributors
- **Newsletter discovery** — find every Substack in a niche by keyword, with subscriber counts
- **Training data / RAG** — clean HTML post bodies ready to chunk and embed
- **Dashboards** — feed reactions, comments and restacks into BI tools

### How it works

1. Each URL is classified — homepage / custom domain / archive → the newsletter's full archive; a `.../p/slug` URL → just that post.
2. Keywords are resolved to publications through Substack's publication search.
3. For every newsletter, the archive is paginated with no depth limit; posts are filtered by type, date and paywall status.
4. With `includeContent`, each post's full HTML body is fetched.
5. With `includeComments`, the post's comment tree (with nested replies) is fetched and flattened counts are billed.
6. With `includePublicationInfo`, the newsletter's metadata is read from its homepage and written to the `publications` dataset.
7. Progress is checkpointed so a platform migration mid-run resumes without duplicates.

### Pricing

| Event | Free | Bronze | Silver | Gold |
|-------|------|--------|--------|------|
| `post` (metadata only) | $0.00099 | $0.00079 | $0.00059 | $0.00039 |
| `post-with-content` | $0.00199 | $0.00179 | $0.00149 | $0.00109 |
| `comment` (per comment incl. replies) | $0.00049 | $0.00039 | $0.00039 | $0.00029 |

Each post fires exactly one of `post` or `post-with-content` depending on `includeContent`. Each saved comment (including every nested reply) fires one `comment` event. Example: 1,000 posts with content and no comments on the Free plan ≈ $1.99.

### FAQ

**Do I need a login or a proxy?**
No. The actor uses Substack's public JSON API directly.

**Does it work with custom domains?**
Yes — pass `https://www.example.com` just like a `*.substack.com` URL.

**Can I get the full archive, not just 12 posts?**
Yes. Set `maxPostsPerNewsletter` to `0` for the complete archive.

**Can I get paywalled post content?**
Substack only serves the preview for paid posts. You always get `truncatedBodyText`, `wordcount`, and all metadata; `bodyHtml` is populated for free posts.

**Why are some newsletters' subscriber counts missing?**
`subscriberCount` is only present when the publication chooses to display it publicly.

**How does keyword discovery work?**
Each keyword is matched against Substack's publication directory. The matching newsletters' recent posts are then scraped, up to `maxSearchResultsPerKeyword` posts per keyword split across those newsletters.

**Can I schedule runs?**
Yes. Use Apify Schedules to run at any interval and only new posts will be added (de-duplicated by post ID within a run).

### Legal and compliance

This actor collects publicly available data from Substack's public API — published posts, public comments, and publicly displayed publication metadata. It does not access private drafts, subscriber lists, or paywalled content. You are responsible for using the exported data in compliance with Substack's terms, applicable laws (including copyright and data-protection rules), and the rights of the content's authors.

# Actor input Schema

## `urls` (type: `array`):

Substack newsletter URLs. Accepts a homepage (foo.substack.com), a custom domain (www.example.com), an /archive URL, or a single post URL (.../p/slug).

## `keywords` (type: `array`):

Topics to discover across public Substack publications. Each keyword finds matching newsletters and pulls their posts.

## `maxSearchResultsPerKeyword` (type: `integer`):

Matching posts to process per keyword (maximum 100).

## `maxPostsPerNewsletter` (type: `integer`):

Max posts per newsletter, newest first. 0 = unlimited (full archive).

## `includeContent` (type: `boolean`):

Include the full HTML body of each post. Disable for metadata-only (faster, cheaper).

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

Fetch comments (with nested replies) for each post. Adds one API call per post and is charged separately per comment.

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

Cap on top-level comment threads kept per post (their replies are always included). 0 = all.

## `includePublicationInfo` (type: `boolean`):

Emit newsletter metadata (subscriber count, pricing, author) to a separate `publications` dataset, and merge the key fields into each post.

## `contentType` (type: `string`):

Filter posts by type.

## `onlyFree` (type: `boolean`):

Only include free posts. Skip paywalled content.

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

Post and comment scraping needs no proxy. Substack's publication SEARCH endpoint, used for keyword discovery, only answers residential IPs — so keywords use this proxy. Ignored when no keywords are given. Default: Apify Proxy, RESIDENTIAL group.

## `startDate` (type: `string`):

Only posts published on or after this date (YYYY-MM-DD).

## `endDate` (type: `string`):

Only posts published on or before this date (YYYY-MM-DD).

## Actor input object example

```json
{
  "urls": [
    "https://www.astralcodexten.com"
  ],
  "keywords": [],
  "maxSearchResultsPerKeyword": 20,
  "maxPostsPerNewsletter": 20,
  "includeContent": true,
  "includeComments": false,
  "maxCommentsPerPost": 0,
  "includePublicationInfo": true,
  "contentType": "all",
  "onlyFree": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "urls": [
        "https://www.astralcodexten.com"
    ],
    "maxPostsPerNewsletter": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("parsebird/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 = {
    "urls": ["https://www.astralcodexten.com"],
    "maxPostsPerNewsletter": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("parsebird/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 '{
  "urls": [
    "https://www.astralcodexten.com"
  ],
  "maxPostsPerNewsletter": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call parsebird/substack-scraper --silent --output-dataset

```

## MCP server setup

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