# Substack Posts Scraper — Newsletter Archive & Stats (`darknezz/substack-posts-scraper`) Actor

Scrape any Substack publication's post archive: titles, subtitles, publish dates, likes, comments, paywall status and (optionally) full post text. Works with custom domains. Perfect for newsletter research, content analysis and AI training data.

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

## Pricing

from $5.00 / 1,000 post scrapeds

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/platform/actors/running/actors-in-store#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 Posts Scraper — Newsletter Archive, Stats & Full Text

Scrape the **complete post archive of any Substack publication** — including custom-domain publications — with engagement stats and optional full post text. One clean JSON item per post, no login, no API key, no proxy required.

### Why use this Actor?

- **Whole archives, not just the latest page** — Substack's API paginates from newest to oldest with no hard cap; this Actor walks it end-to-end up to your chosen limit.
- **Custom domains supported** — pass `astralcodexten`, `name.substack.com` or `https://any-custom-domain.com`; all three resolve correctly.
- **Engagement data included** — likes, comments, word count and paywall status on every post, ready for analysis.
- **Full-text mode** — set `includeBody: true` and get clean article text for AI/RAG pipelines (public posts only).
- **Paywall-safe** — paywalled posts return their public metadata and preview; protected text is never scraped.

### What you get per post

| Field | Description |
|---|---|
| `title`, `subtitle`, `description` | Post heading, subheading and preview text |
| `slug`, `url` | Post slug and canonical URL |
| `publishedAt` | Publish date (ISO 8601) |
| `type` | `newsletter`, `podcast` or `thread` |
| `audience`, `isPaywalled` | Audience setting and paywall flag |
| `wordCount`, `likes`, `comments` | Engagement metrics |
| `coverImage` | Cover image URL |
| `bodyText` | Full post text (only when `includeBody: true`, public posts) |

### Input

```json
{
  "publications": ["astralcodexten", "https://www.noahpinion.blog"],
  "maxPostsPerPublication": 100,
  "includeBody": false
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `publications` | array of strings | — | Bare names (`astralcodexten`), subdomains (`name.substack.com`) or full URLs — custom domains work too. **Required.** |
| `maxPostsPerPublication` | integer | 50 | Maximum posts per publication, newest first (1–5000). |
| `includeBody` | boolean | false | Fetch full text of each public post (slower — one extra request per post). |

### Output (one item per post)

```json
{
  "publication": "https://astralcodexten.substack.com",
  "postId": 158204926,
  "title": "Your Book Review: ...",
  "subtitle": "Or: why the best books are the ones you argue with",
  "slug": "your-book-review",
  "url": "https://www.astralcodexten.com/p/your-book-review",
  "publishedAt": "2026-06-20T12:01:33.000Z",
  "type": "newsletter",
  "audience": "everyone",
  "isPaywalled": false,
  "wordCount": 8214,
  "likes": 312,
  "comments": 447,
  "coverImage": "https://substackcdn.com/image/fetch/...",
  "bodyText": "The full article text when includeBody is enabled..."
}
```

### Use cases

- **Newsletter operators** — study what performs in your niche before writing your next issue
- **Content & trend research** — track topics, formats and engagement across publications over time
- **AI / RAG pipelines** — feed clean long-form text with metadata into embeddings and fine-tuning
- **Journalists & analysts** — archive and monitor influential newsletters in your beat
- **Competitive intelligence** — see which headlines and subjects get the most hearts and comments

### Pricing

Pay per event: you are charged a small fee **per post scraped**, plus Apify's standard compute costs. No subscription, no minimums — scan one archive or a hundred.

### FAQ

**Does it get paywalled content?** No. Paywalled posts return their public metadata and preview only; `bodyText` is fetched exclusively for public posts.

**How far back does it go?** The whole archive — the API paginates from newest to oldest with no hard cap. Set `maxPostsPerPublication` to bound the run.

**Can I scrape a publication on a custom domain?** Yes. Pass the full URL and the Actor resolves it to the publication's Substack API endpoint automatically.

**Does it need a login or proxy?** No — the public Substack API is used; no cookies, no residential proxies.

**What if a publication is inactive or deleted?** The run reports it as skipped rather than failing the whole batch, so one dead link never wastes the rest of the run.

# Actor input Schema

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

Substack names (e.g. 'astralcodexten'), subdomains, or full URLs (custom domains work).

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

Maximum posts to scrape per publication (newest first).

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

Fetch the full text of each public post (slower — one extra request per post).

## Actor input object example

```json
{
  "publications": [
    "astralcodexten"
  ],
  "maxPostsPerPublication": 50,
  "includeBody": false
}
```

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("darknezz/substack-posts-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"] }

# Run the Actor and wait for it to finish
run = client.actor("darknezz/substack-posts-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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"
  ]
}' |
apify call darknezz/substack-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=darknezz/substack-posts-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/4QvwC36CcgBsnoPW1/builds/XdBwiYeJHaRCi2hab/openapi.json
