# Substack Scraper - Posts, Full Text, Comments & Engagement (`alex9080/substack-scraper`) Actor

Scrape any Substack newsletter: every post with title, subtitle, date, authors, full text of free posts (clean Markdown-style text or HTML), likes, comments count, restacks, paid/free flag, tags, plus optional comments. Custom domains supported. Date and keyword filters, new-posts-only monitoring.

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

## Pricing

from $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

Scrape **any Substack newsletter**, including ones on custom domains. For every post you get the title, subtitle, date, authors, **full text of free posts** (clean, readable text with headings and lists, or the original HTML), **likes, comment count and restacks**, word count, paid/free flag, tags, section, cover image and podcast link. Turn on comments to also get every comment and reply.

Use it to analyse what topics perform best, monitor competitors' newsletters, build a dataset for an LLM or RAG, research creators, or archive a newsletter.

#### Features

- **Any input**: `https://name.substack.com`, custom domains (`https://www.lennysnewsletter.com`), just the subdomain (`name`), `substack.com/@handle` profiles, or links to single posts.
- **Whole archive** or the latest N posts, newest first or most popular first.
- **Full text** of free posts; paid posts give the public preview and are flagged with `isPaid: true`.
- **Comments with replies** (`parentId` links a reply to its comment).
- **Filters**: date cut-off and keywords.
- **New posts only**: for scheduled runs it remembers the newest post per newsletter.

#### Output

```json
{
  "type": "post",
  "newsletter": "https://www.lennysnewsletter.com",
  "title": "All of the Lenny & Friends Summit talks are now online!",
  "subtitle": "Plus, some reflections and takeaways from the day",
  "url": "https://www.lennysnewsletter.com/p/all-of-the-lenny-and-friends-summit",
  "date": "2026-09-29T13:15:57.512Z",
  "authors": [{"name": "Lenny Rachitsky", "handle": "lenny"}],
  "isPaid": false,
  "wordCount": 1276,
  "reactions": 271,
  "comments": 6,
  "restacks": 4,
  "text": "I'm excited to share that every main-stage talk ...",
  "isFullText": true
}
```

Comment rows (`"type": "comment"`): postUrl, commentId, parentId, author, authorHandle, date, text, reactions, url.

#### Input example

```json
{
  "newsletters": ["https://www.lennysnewsletter.com", "https://www.astralcodexten.com"],
  "maxPostsPerNewsletter": 100,
  "since": "2026-01-01",
  "includeComments": true
}
```

#### Pricing

**$0.50 per 1,000 posts** and **$0.10 per 1,000 comments**. No subscription.

#### Use from code

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("alex9080/substack-scraper").call(run_input={
    "newsletters": ["https://www.lennysnewsletter.com"], "maxPostsPerNewsletter": 20,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["date"], item["reactions"], item["title"])
```

#### Notes

Only publicly available content is collected: paid posts are returned as the public preview, never the paywalled text. Respect authors' copyright when reusing the text.

# Actor input Schema

## `newsletters` (type: `array`):

Newsletter URLs (https://name.substack.com or a custom domain), subdomain names (name), substack.com/@handle profiles, or links to single posts (/p/slug).

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

0 = the whole archive.

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

Newest first is needed for the date cut-off and new-only mode.

## `since` (type: `string`):

Skip posts published before this date.

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

Case-insensitive, matched against title, subtitle and text.

## `includeFullText` (type: `boolean`):

Full text of free posts (paid posts give the public preview). Off = only the short preview, faster.

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

Original post HTML in an html field.

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

Adds one row per comment (with replies) for posts that have comments.

## `onlyNewPosts` (type: `boolean`):

For scheduled monitoring: remembers the newest post per newsletter (in your own storage).

## Actor input object example

```json
{
  "newsletters": [
    "https://www.lennysnewsletter.com",
    "https://www.astralcodexten.com"
  ],
  "maxPostsPerNewsletter": 50,
  "sort": "new",
  "includeFullText": true,
  "includeHtml": false,
  "includeComments": false,
  "onlyNewPosts": false
}
```

# Actor output Schema

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

No description

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

No description

## `all` (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 = {
    "newsletters": [
        "https://www.lennysnewsletter.com",
        "https://www.astralcodexten.com"
    ]
};

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

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

```

## MCP server setup

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