# Substack Scraper - Newsletter Posts & Full Text (`sumitr_mardy/substack-scraper`) Actor

Substack scraper, $0.50 per 1,000 posts: Substack posts from any Substack newsletter archive, custom domains included, with title, date, author, likes, comments, restacks, paid flag and Substack full text. Newsletter posts scraper; newest or top, no login.

- **URL**: https://apify.com/sumitr_mardy/substack-scraper.md
- **Developed by:** [Sumitr Mardy](https://apify.com/sumitr_mardy) (community)
- **Categories:** Social media, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

Scrape every post of any Substack newsletter, custom domains included: **title, date, author, likes, comments, restacks, word count, paid flag** and, if you want, the **full text** as clean text and HTML. Newest first or most liked, with an optional date cut-off.

Built for newsletter writers studying competitors, marketers tracking a niche, researchers, and AI pipelines that need newsletter text.

**$0.50 per 1,000 posts.** Failed newsletters are free. No login, no Substack account.

### What you get

| Field | Example |
|---|---|
| `newsletter`, `newsletterUrl` | Astral Codex Ten, https://astralcodexten.substack.com |
| `postId`, `title`, `subtitle`, `url`, `slug` | 225455324, Varieties Of Discourseposting, https://www.astralcodexten.com/p/... |
| `type`, `postDate` | newsletter, 2026-11-18T07:47:03.648Z |
| `audience`, `isPaid` | everyone, false |
| `author`, `authors` | Scott Alexander, \["Scott Alexander"] |
| `wordCount`, `likes`, `comments`, `restacks` | 1552, 218, 152, 15 |
| `section`, `tags`, `coverImage`, `podcastUrl` | |
| `contentText`, `contentHtml` | full body with *Include full text* |
| `status` | `ok`, `no_results`, `failed`, `not_found`, `invalid_input` |

Fixed shape: numbers `0` when unknown, lists always lists, text `""` when missing.

### How to use it

- **Newsletters**: one per line, as a subdomain (`astralcodexten`), a URL (`https://www.lennysnewsletter.com`) or any post URL from the newsletter.
- **Max posts per newsletter**: newest first, or most liked with *Sort = Top*.
- **Include full text**: adds the body as text and HTML (one extra request per post, same price).
- **Published after**: only posts on or after a date (with *Newest first*).

### Pricing

Pay per event, **$0.0005 per post** ($0.50 per 1,000), cheaper on higher Apify plans. Full text costs nothing extra. Failed newsletters and invalid inputs are free; each post is billed once per run. Apify adds its standard tiny start event per run.

### Honest limits

- **Paid posts**: only the free preview Substack shows to non-subscribers. `isPaid` tells you which ones.
- **No subscriber counts per post or open rates**: Substack does not publish them.
- **No comment text** in this version, only the comment count.
- Public data only. Use it in line with Substack's terms.

### Use it from AI agents (MCP)

Hosted, with OAuth sign-in:

```json
{
    "mcpServers": {
        "substack": {
            "url": "https://mcp.apify.com/?tools=sumitr_mardy/substack-scraper"
        }
    }
}
```

With an API token instead of OAuth:

```json
{
    "mcpServers": {
        "substack": {
            "url": "https://mcp.apify.com/?tools=sumitr_mardy/substack-scraper",
            "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
        }
    }
}
```

Local stdio:

```json
{
    "mcpServers": {
        "substack": {
            "command": "npx",
            "args": ["-y", "@apify/actors-mcp-server", "--actors", "sumitr_mardy/substack-scraper"],
            "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
        }
    }
}
```

### Run it from code

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("sumitr_mardy/substack-scraper").call(run_input={
    "newsletters": ["astralcodexten"],
    "maxPostsPerNewsletter": 20,
    "includeContent": True,
})
for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(p["postDate"][:10], p["title"], p["likes"], len(p["contentText"]))
```

cURL (waits for the run and returns the rows):

```bash
curl -X POST "https://api.apify.com/v2/acts/sumitr_mardy~substack-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"newsletters":["https://www.lennysnewsletter.com"],"maxPostsPerNewsletter":25,"sort":"top"}'
```

### FAQ

**Do custom domains work?** Yes. Paste the newsletter's own address, e.g. `https://www.lennysnewsletter.com`.

**Which posts did best?** Set *Sort* to *Top*: posts come back most liked first, with likes, comments and restacks.

**Can I keep an archive up to date?** Schedule the actor with *Published after* set to your last run's date.

# Actor input Schema

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

Substack newsletters: a subdomain like "astralcodexten", a URL like https://www.lennysnewsletter.com, or any post URL from the newsletter.

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

Newest first (or most liked with Sort = Top).

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

Newest posts first, or the most liked first.

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

Add the post body as text and HTML (one extra request per post, same price). Paid posts return only the free preview.

## `publishedAfter` (type: `string`):

Only posts on or after this date. Works with Sort = Newest first.

## Actor input object example

```json
{
  "newsletters": [
    "astralcodexten",
    "https://www.lennysnewsletter.com"
  ],
  "maxPostsPerNewsletter": 50,
  "sort": "new",
  "includeContent": false
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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