# Substack Scraper & API (`arbalest/substack-scraper`) Actor

Scrape Substack newsletters: posts with full content (Markdown/text/HTML), comments, subscriber counts, paid-subscriber ranges, pricing, recommendations, category leaderboards and keyword search. No login or browser needed.

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

## Pricing

Pay per event

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 & API

Scrape any Substack newsletter: posts with full content in Markdown, text or HTML, comments, **subscriber counts**, **paid-subscriber ranges**, **subscription prices**, recommendations, category leaderboards and keyword search.

No login, no browser and no API key needed. It reads the same public data Substack's own website loads, so runs are fast and cheap.

### What can it do?

| Mode | What you get | Typical use |
|---|---|---|
| **Posts** | Every post from one or more newsletters: title, date, likes, comments, restacks, word count, tags, authors and full content | AI/RAG datasets, content research, archiving, competitor monitoring |
| **Newsletter profiles** | Subscriber count, paid-subscriber range, monthly, yearly and founding prices, author, launch date and recommended newsletters | Sponsorship prospecting, creator research, market sizing |
| **Category leaderboards** | Substack's top newsletters in any category (Bestsellers, Trending or overall), ranked, with subscriber counts and prices | Build lead lists of the top newsletters in finance, tech, politics and more |
| **Keyword search** | Posts and newsletters matching any keyword | Find newsletters in a niche, track topics |

### Input examples

**All posts since a date, as Markdown, with comments**

```json
{
  "mode": "posts",
  "startUrls": ["https://www.lennysnewsletter.com", "noahpinion", "@astralcodexten"],
  "maxPostsPerPublication": 100,
  "postsSince": "2026-01-01",
  "includeContent": true,
  "contentFormat": "markdown",
  "includeComments": true
}
```

**Subscriber counts and pricing for a list of newsletters**

```json
{
  "mode": "publications",
  "startUrls": ["lenny", "https://www.noahpinion.blog", "https://substack.com/@astralcodexten"],
  "includeRecommendations": true
}
```

**Top 200 paid newsletters in Finance and Technology**

```json
{
  "mode": "leaderboard",
  "categories": ["finance", "technology"],
  "leaderboardType": "paid",
  "maxPublicationsPerCategory": 200
}
```

**Newsletters about AI agents**

```json
{
  "mode": "search",
  "searchQueries": ["ai agents"],
  "searchResultType": "publications",
  "maxSearchResultsPerQuery": 100
}
```

Start URLs accept bare subdomains (`lenny`), `*.substack.com` URLs, custom domains, post URLs (`…/p/slug`), `open.substack.com` links and author profiles (`@handle`, `substack.com/@handle`).

### Output

Each item has a `type` field: `publication`, `post` or `comment`. The dataset has separate table views for each type.

**Newsletter (publication)**

```json
{
  "type": "publication",
  "name": "Lenny's Newsletter",
  "url": "https://www.lennysnewsletter.com",
  "authorName": "Lenny Rachitsky",
  "authorProfileUrl": "https://substack.com/@lenny",
  "subscriberCount": 1200000,
  "subscriberCountText": "Over 1,200,000 subscribers",
  "paidSubscriberRange": "Tens of thousands of paid subscribers",
  "hasPaidSubscriptions": true,
  "currency": "USD",
  "monthlyPrice": 20,
  "yearlyPrice": 200,
  "foundingMemberPrice": 400,
  "firstPostDate": "2019-06-14T15:00:48.833Z"
}
```

In leaderboard mode each newsletter also has `leaderboardCategory`, `leaderboardType` and `leaderboardRank`.

**Post**

```json
{
  "type": "post",
  "publicationName": "Noahpinion",
  "title": "Anthropic’s moat is Claude",
  "url": "https://www.noahpinion.blog/p/anthropics-moat-is-claude",
  "postDate": "2026-11-02T11:03:51.832Z",
  "audience": "only_paid",
  "isPaywalled": true,
  "isPreviewOnly": true,
  "wordcount": 3542,
  "reactionCount": 233,
  "commentCount": 57,
  "restacks": 18,
  "authors": [{ "name": "Noah Smith", "handle": "noahpinion" }],
  "tags": [],
  "contentFormat": "markdown",
  "content": "…Anthropic [recently filed for IPO](https://www.bloomberg.com/…). At an estimated $1.5…"
}
```

**Comment**: `postUrl`, `authorName`, `authorHandle`, `body`, `date`, `reactionCount`, `parentId` and `depth`. Replies are flattened in thread order.

### Good to know

- **Paywalled posts:** the scraper only collects what Substack shows logged-out readers. For paid posts that's the free preview, marked with `isPreviewOnly: true`. It never bypasses a paywall.
- **Subscriber counts** are the rounded figures Substack itself displays, such as "Over 463,000 subscribers". Paid subscribers are only published as ranges, such as "Thousands of paid subscribers". Some newsletters hide their counts; those fields are `null`.
- **Leaderboards** exist for Substack's top-level categories. If you enter a subcategory (for example "Personal Finance"), the scraper uses its parent category (Finance) and logs a warning.
- **Proxies** are usually unnecessary. If you scrape tens of thousands of pages and see HTTP 429 errors, turn on Apify Proxy and lower *Max concurrency*.

### Pricing

Pay per result. You're charged only for items saved to the dataset:

| Event | Charged when |
|---|---|
| `publication` | a newsletter profile is saved |
| `post` | a post is saved |
| `comment` | a comment is saved |

Set *Maximum cost per run* in the run options. The scraper stops cleanly when it reaches it.

### Use with AI agents

Choose `contentFormat: "markdown"` for clean, LLM-ready text. The Actor can be called from the Apify MCP server, the Apify API, n8n, Make or Zapier.

# Changelog

This Actor's version history is a separate document: https://apify.com/arbalest/substack-scraper/changelog.md

# Actor input Schema

## `mode` (type: `string`):

<b>posts</b>: posts (and optionally full content and comments) from the newsletters in Start URLs.<br><b>publications</b>: newsletter profiles with subscriber counts, paid-subscriber range and pricing.<br><b>leaderboard</b>: Substack's top newsletters in one or more categories, with subscriber counts. Good for building sponsorship or outreach lists.<br><b>search</b>: search Substack by keyword.

## `startUrls` (type: `array`):

Newsletters, posts or authors. Accepts <code>lenny</code>, <code>lenny.substack.com</code>, custom domains like <code>https://www.lennysnewsletter.com</code>, post URLs (<code>…/p/slug</code>) and author profiles (<code>@lenny</code> or <code>https://substack.com/@lenny</code>). Used by the <b>posts</b> and <b>publications</b> modes.

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

Stop after this many posts from each newsletter.

## `postsSince` (type: `string`):

Skip older posts. Format: YYYY-MM-DD.

## `postsSort` (type: `string`):

Newest first, or the newsletter's most popular posts first.

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

Fetch each post's body. Paywalled posts include only the free preview Substack shows logged-out readers (flagged with isPreviewOnly). Turn off for faster, metadata-only runs.

## `contentFormat` (type: `string`):

Format for the post body. Markdown keeps headings, links and images and is the best choice for AI/LLM pipelines.

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

Save each post's comments as separate items (type = comment).

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

Stop after this many comments per post (replies included).

## `includeRecommendations` (type: `boolean`):

In publications mode, list the newsletters each publication recommends. Useful for mapping a niche.

## `categories` (type: `array`):

Substack categories or subcategories, by name or slug: technology, business, finance, culture, us-politics, health, science, food, sports, crypto, education… Used by the <b>leaderboard</b> mode.

## `leaderboardType` (type: `string`):

Which Substack leaderboard to read. Bestsellers ranks by paid subscribers.

## `maxPublicationsPerCategory` (type: `integer`):

Stop after this many newsletters in each category.

## `searchQueries` (type: `array`):

Keywords to search on Substack. Used by the <b>search</b> mode.

## `searchResultType` (type: `string`):

Save matching posts, the newsletters that published them (with subscriber counts and pricing), or both.

## `maxSearchResultsPerQuery` (type: `integer`):

Stop after this many results for each keyword.

## `maxConcurrency` (type: `integer`):

Parallel requests. Substack tolerates moderate rates; lower this if you see HTTP 429 errors.

## `maxRequestsPerMinute` (type: `integer`):

Upper limit on request rate, to stay polite to Substack.

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

Usually not needed: Substack's public endpoints work without a proxy. Turn on Apify Proxy if you scrape at high volume and start seeing 429 or 403 errors.

## Actor input object example

```json
{
  "mode": "posts",
  "startUrls": [
    "https://www.lennysnewsletter.com"
  ],
  "maxPostsPerPublication": 10,
  "postsSort": "new",
  "includeContent": true,
  "contentFormat": "markdown",
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "includeRecommendations": false,
  "leaderboardType": "paid",
  "maxPublicationsPerCategory": 100,
  "searchResultType": "posts",
  "maxSearchResultsPerQuery": 50,
  "maxConcurrency": 5,
  "maxRequestsPerMinute": 120,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Every saved item (newsletters, posts and comments).

## `publications` (type: `string`):

Newsletter profiles with subscriber counts and pricing.

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

Posts with metadata and, if requested, full content.

## `comments` (type: `string`):

Comments on scraped posts.

# 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 = {
    "mode": "posts",
    "startUrls": [
        "https://www.lennysnewsletter.com"
    ],
    "maxPostsPerPublication": 10
};

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

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

```

## MCP server setup

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