# Substack Scraper — Newsletter Posts, Full Text, Comments (`jaybird/substack-scraper`) Actor

Scrape posts from any Substack newsletter, including custom domains: full text and Markdown of free posts, title, date, author, likes, comment count, paywall flag, cover image, optional comments and publication info. Filter by date, keyword and free/paid. No login, no start fee.

- **URL**: https://apify.com/jaybird/substack-scraper.md
- **Developed by:** [Jaybird Technologies](https://apify.com/jaybird) (community)
- **Categories:** News, AI, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 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 — Newsletter Posts, Full Text, Comments

Scrape posts from **any Substack newsletter**, including newsletters on **custom domains** (like `lennysnewsletter.com` or `noahpinion.blog`). For each post you get the title, subtitle, date, author(s), likes, comment and restack counts, paywall flag, cover image, word count, tags, and the **full body as plain text and Markdown** for free posts. Optionally add **public comments** and **newsletter info with Substack's subscriber-count hint**.

No login, no cookies, no browser. **No start fee: you pay only per saved post.**

### What you can do with it

- Track what competitors or industry writers publish, with likes and comment counts.
- Build LLM / RAG datasets from newsletter archives (Markdown output keeps headings and links).
- Monitor a list of newsletters daily with a date filter (`dateFrom: "1 day"`).
- Research which posts get the most engagement (`sort: top`).
- Find posts on a topic inside a newsletter with Substack's own search.

### Input

| Field | What it does |
|---|---|
| `publications` | One per line: `astralcodexten`, `https://noahpinion.substack.com`, `https://www.lennysnewsletter.com`, a post URL `https://…/p/slug`, or a writer handle `@lenny` |
| `maxPostsPerPublication` | Posts per newsletter after filters (default 50, `0` = whole archive) |
| `maxItems` | Total cap for the run (default 1,000) |
| `sort` | `new` (newest first) or `top` (most popular) |
| `dateFrom` / `dateTo` | `2026-10-01`, an ISO timestamp, or relative like `30 days`, `2 weeks` |
| `searchQuery` | Keyword search inside each newsletter (Substack archive search, relevance order) |
| `audience` | `all`, `free` (public posts only) or `paid` (paywalled only) |
| `includeContent` | Body as plain text (default on) |
| `includeMarkdown` | Body as Markdown (default on) |
| `includeHtml` | Cleaned body HTML (default off, large) |
| `includeComments` / `maxCommentsPerPost` | Attach top public comments with replies (no extra charge) |
| `includePublicationInfo` | Attach newsletter name, description, author, logo, custom domain, subscriber hint |

Example:

```json
{
  "publications": ["astralcodexten", "https://www.lennysnewsletter.com", "@noahpinion"],
  "maxPostsPerPublication": 20,
  "dateFrom": "90 days",
  "includeComments": true,
  "maxCommentsPerPost": 10
}
```

### Output

One dataset item per post:

```json
{
  "id": 224567415,
  "url": "https://www.astralcodexten.com/p/vote-in-the-2026-book-review-contest",
  "title": "Vote In The 2026 Book Review Contest",
  "subtitle": "...",
  "postDate": "2026-11-14T00:23:27.919Z",
  "type": "newsletter",
  "audience": "everyone",
  "isPaywalled": false,
  "author": "Scott Alexander",
  "authors": [{ "name": "Scott Alexander", "handle": "astralcodexten" }],
  "wordCount": 146,
  "readingTimeMinutes": 1,
  "reactionCount": 43,
  "commentCount": 26,
  "restacks": 0,
  "coverImage": "https://substack-post-media.s3.amazonaws.com/…jpeg",
  "tags": [],
  "publicationName": "Astral Codex Ten",
  "publicationUrl": "https://www.astralcodexten.com",
  "bodyText": "If you’ve read the finalists of this year’s non-book review contest, vote for your favorite here…",
  "bodyMarkdown": "If you’ve read the finalists … **[vote for your favorite here](https://forms.gle/…)** …",
  "contentIsPreview": false,
  "comments": [{ "author": "Zach Mackin", "date": "2026-11-14T00:24:48.917Z", "body": "These have been incredible!", "reactionCount": 4, "depth": 0 }],
  "publication": {
    "name": "Lenny's Newsletter",
    "customDomain": "www.lennysnewsletter.com",
    "authorName": "Lenny Rachitsky",
    "subscriberCountText": "Over 1,200,000 subscribers",
    "subscriberCountApprox": 1000000,
    "paidSubscriberCountText": "Tens of thousands of paid subscribers"
  },
  "scrapedAt": "2026-11-14T17:11:08.464Z"
}
```

The table view shows cover, title, newsletter, author, date, paywall flag, words, likes, comments and restacks. A second view shows the full text.

### Pricing

**$0.50 per 1,000 posts** (pay per event, `$0.0005` per saved post). No start fee. Body text, Markdown, HTML, comments and newsletter info are included at no extra charge. Filtered-out posts are not charged. Set a max total charge on the run to cap spend; the Actor stops when it is reached.

### Limits (read this)

- **Paywalled posts:** only the free preview Substack shows to non-subscribers is returned (`contentIsPreview: true`). This Actor does not log in and cannot read paid content.
- **Comments** are returned for free posts only. Substack does not show comments on paywalled posts to non-subscribers, so `comments` is empty there (the `commentCount` is still filled).
- **Subscriber counts** are Substack's own public hints (for example "Over 1,200,000 subscribers" or "Tens of thousands of paid subscribers"). Many newsletters don't show one; then the fields are `null`.
- **Keyword search** uses Substack's archive search, which returns results by relevance, so date filters are applied but cannot stop paging early.
- `sort: top` with a date filter scans more pages to find matches.
- Substack Notes, chats, the global substack.com search and leaderboards are not included in this version.
- Data comes from Substack's public website endpoints, which can change without notice.
- Scrape responsibly and respect authors' copyright; republishing full posts may need permission.

### FAQ

**Does it work with custom domains?** Yes. Pass the domain (`https://www.lennysnewsletter.com`) or the `*.substack.com` address.

**Do I need a proxy?** The default (Apify datacenter proxy, included in Apify plans) is recommended: Substack rate-limits busy shared IPs. If you turn the proxy off and Substack returns HTTP 429, the Actor switches to Apify datacenter proxy by itself. Residential proxy is not needed.

**Why did a newsletter fail?** The run's status and the `RUN_STATS` record list each input with a reason (for example "publication not found (or not a Substack site)").

# Actor input Schema

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

One per line. Accepts a subdomain (<code>astralcodexten</code>), a Substack URL (<code>https://noahpinion.substack.com</code>), a custom domain (<code>https://www.lennysnewsletter.com</code>), a single post URL (<code>https://…/p/post-slug</code>) or a writer handle (<code>@lenny</code>, scrapes their main publication).

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

Stop after this many posts per newsletter (after filters). 0 = no limit (whole archive).

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

Hard cap for the whole run. You are charged only for saved posts.

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

<code>new</code> = newest first (date filters stop early, cheapest). <code>top</code> = most popular first.

## `dateFrom` (type: `string`):

Date like <code>2026-10-01</code>, an ISO timestamp, or a relative period like <code>30 days</code>, <code>2 weeks</code>, <code>1 year</code>.

## `dateTo` (type: `string`):

Date like <code>2026-10-31</code> (inclusive), an ISO timestamp, or a relative period.

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

Uses Substack's own archive search (title and content). Results come in relevance order.

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

Keep all posts, only free (public) posts, or only paywalled posts (paywalled posts include the public preview text only).

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

Fetch the post body as plain text. Free posts: full text. Paywalled posts: only the free preview Substack shows to non-subscribers. Turn off for faster metadata-only runs (same price).

## `includeMarkdown` (type: `boolean`):

Also add the body as Markdown with links and headings kept.

## `includeHtml` (type: `boolean`):

Also add the cleaned body HTML (large).

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

Attach public comments (with replies) to each post. No extra charge.

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

Top comments first (best first), replies included in the count.

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

Attach newsletter name, description, author, logo, custom domain and Substack's public subscriber-count hint (for example "Over 1,200,000 subscribers") to each post.

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

Recommended: Apify Proxy (datacenter, default). Substack rate-limits busy shared IPs; with a proxy each request can use a fresh IP. If you turn it off and Substack starts returning HTTP 429, the Actor switches to Apify datacenter proxy automatically.

## Actor input object example

```json
{
  "publications": [
    "astralcodexten",
    "https://www.lennysnewsletter.com",
    "@noahpinion"
  ],
  "maxPostsPerPublication": 10,
  "maxItems": 100,
  "sort": "new",
  "audience": "all",
  "includeContent": true,
  "includeMarkdown": true,
  "includeHtml": false,
  "includeComments": false,
  "maxCommentsPerPost": 20,
  "includePublicationInfo": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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": [
        "astralcodexten",
        "https://www.lennysnewsletter.com",
        "@noahpinion"
    ],
    "maxPostsPerPublication": 10,
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("jaybird/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": [
        "astralcodexten",
        "https://www.lennysnewsletter.com",
        "@noahpinion",
    ],
    "maxPostsPerPublication": 10,
    "maxItems": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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