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

Extract posts, full article text, likes, restacks, comments and podcast episodes from any Substack newsletter. Works with custom domains. No login needed.

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

## Pricing

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

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

Extract **posts, full article text, likes, restacks, comments and podcast episodes** from any Substack newsletter, including publications on custom domains. No login, no API key.

Give it newsletter URLs (or just the subdomain) and get a structured dataset of the newest posts with author, date, audience (free or paid), engagement numbers and the readable article body as plain text and HTML. Optionally scrape the full comment thread of every post.

### What can you do with it?

- **Research and competitive analysis**: what the leading newsletters in your niche publish, how often, and what gets the most likes and comments.
- **Content monitoring**: schedule the Actor and get every new post from the newsletters you follow in Slack, Notion or your inbox, before it hits your crowded mailbox.
- **AI and RAG pipelines**: feed clean article text into a vector database or an agent. Works with the Apify MCP server.
- **Audience and engagement analytics** for your own publication: likes, restacks, comment counts and word counts per post over time.
- **Podcast indexing**: episode titles, audio URLs and durations of Substack podcasts.
- **Comment mining**: who comments, how often, and what readers ask for.

### Features

- Accepts `name`, `name.substack.com`, `https://custom-domain.com` or a single post URL (`/p/slug`).
- Newest posts first with automatic pagination; stop by count (`maxPostsPerPublication`) or by date (`postedAfter`).
- Substack-side **keyword search** (`search`) so you only pay for matching posts.
- Full article body as `bodyText` and `bodyHtml` (free posts). Paywalled posts return the public preview and are flagged with `bodyIsPreviewOnly: true`.
- Engagement: likes, comment count, restacks, word count, audience (`everyone`, `only_paid`, `founding`).
- Optional **comments** as separate records with threading (`parentCommentId`, `depth`), author handle, date and likes.
- Publication metadata on every record (name, description, URL).
- Unreachable or non-Substack sites produce an `error` record instead of failing the run.
- No browser, no proxy needed: fast and inexpensive.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `publications` | array | required | Newsletter URLs, subdomains or single post URLs. |
| `maxPostsPerPublication` | integer | 50 | Newest posts first. |
| `search` | string | – | Keyword filter applied by Substack's archive search. |
| `postedAfter` | string | – | ISO date. Pagination stops at older posts. |
| `includeBody` | boolean | true | Fetch each post for `bodyText` / `bodyHtml`. |
| `includeComments` | boolean | false | Also output `comment` records for every post. |
| `proxyConfiguration` | object | none | Optional Apify Proxy settings. |

Example:

```json
{
    "publications": ["https://www.lennysnewsletter.com", "stratechery"],
    "maxPostsPerPublication": 100,
    "postedAfter": "2026-01-01",
    "includeBody": true,
    "includeComments": true
}
```

### Output

Post record:

```json
{
    "type": "post",
    "publication": "www.lennysnewsletter.com",
    "publicationUrl": "https://www.lennysnewsletter.com",
    "publicationName": "Lenny's Newsletter",
    "postId": 219482066,
    "slug": "how-to-tell-if-a-startup-has-a-moat",
    "url": "https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat",
    "title": "How to tell if a startup has a moat",
    "subtitle": "A practical framework...",
    "postType": "newsletter",
    "postDate": "2026-10-13T11:00:00.000Z",
    "audience": "only_paid",
    "isPaywalled": true,
    "authors": ["Dan Hockenmaier"],
    "authorHandles": ["danhock"],
    "likes": 219,
    "comments": 12,
    "restacks": 2,
    "wordCount": 4153,
    "coverImage": "https://substackcdn.com/image/...",
    "podcastUrl": null,
    "bodyText": "Most founders think they have a moat...",
    "bodyHtml": "<p>Most founders think...</p>",
    "bodyWordCount": 1980,
    "bodyIsPreviewOnly": true
}
```

Comment record:

```json
{
    "type": "comment",
    "publication": "www.lennysnewsletter.com",
    "postId": 219482066,
    "postUrl": "https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat",
    "commentId": 1234567,
    "parentCommentId": null,
    "depth": 0,
    "date": "2026-09-29T23:34:47.245Z",
    "name": "Product Mindset",
    "handle": "productmindset",
    "body": "Thank you for putting this together...",
    "likes": 4
}
```

### Pricing

You pay per post and, if enabled, per comment. No platform usage fees are added. A typical newsletter archive of 300 posts with full text finishes in about a minute.

### Tips

- **Weekly digest**: schedule the Actor with `postedAfter` and send the results through an Apify integration (email, Slack, Google Sheets, Make, Zapier, n8n).
- **Only free content**: filter the dataset on `audience = "everyone"` or `bodyIsPreviewOnly = false`.
- **Custom domains**: just paste the domain; the Actor follows Substack's redirects automatically.

### Limitations

- Paywalled posts are returned with the preview Substack shows to non-subscribers; the Actor never bypasses paywalls.
- Notes (the social feed) are not included.

### Legal and fair use

The Actor reads pages and endpoints Substack serves publicly. Respect authors' copyright and the privacy of commenters when you store or republish data.

### Support

Open an issue on the **Issues** tab for broken publications, extra fields or bulk needs. Issues are usually answered within a day.

You can also email <support@agentsgearbox.com>. More actors, daily-updated comparisons of scrapers for 200+ websites and custom scraper requests at [agentsgearbox.com](https://agentsgearbox.com).

# Actor input Schema

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

Substack newsletter URLs or subdomains, e.g. `lenny`, `https://www.lennysnewsletter.com`, `https://stratechery.substack.com`. A single post URL also works and scrapes only that post.

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

Newest posts first.

## `search` (type: `string`):

Optional keyword filter applied by Substack's own archive search.

## `postedAfter` (type: `string`):

Optional ISO date such as `2026-01-01`. Pagination stops when older posts are reached.

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

Fetch each post and add `bodyText` (plain text) and `bodyHtml`. Paywalled posts return only the free preview. Costs one extra request per post.

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

Also scrape the comment thread of each post as separate records (`type: "comment"`).

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

Substack rarely blocks. Enable Apify Proxy only if you see HTTP 403/429.

## Actor input object example

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

# Actor output Schema

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

Posts and comments as JSON (one item per post or comment).

# 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": [
        "https://www.lennysnewsletter.com"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

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

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

```

## MCP server setup

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