# Substack Scraper — Newsletter Posts & Full Text ($0.60/1K) (`meka.im/substack-scraper`) Actor

Extract Substack newsletter posts, author metadata, engagement counts, paywall flags, and optional full body text from Substack handles, custom domains, or direct post URLs with $0 start fee.

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

## Pricing

from $0.38 / 1,000 delivered substack 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/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

Extract Substack newsletter posts, author metadata, engagement counts (likes, comments, restacks), tags, paywall flags, and optional full post text from any public Substack publication — including custom domains and direct post URLs.

- **Pure HTTP API extraction** — no browser overhead, fast edge execution with automatic fallback.
- **Pay-per-event with `$0` start fee** — pay only `$0.60 / 1,000` posts delivered (`$0.0006` per post). Invalid handles, empty results, and duplicates on resume are free.
- **Supports handles, Substack URLs, custom domains, and direct post URLs** — pass `astralcodexten`, `https://www.lennysnewsletter.com`, `https://newsletter.pragmaticengineer.com`, or `https://.../p/<slug>`.
- **Clean paywall handling** — accurately sets `isPaywalled` and `audience` (`everyone`, `only_paid`, `founding`) and extracts full plain text for free posts without crashing on paywalled articles.

### Input example

```json
{
  "publications": [
    "astralcodexten",
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com"
  ],
  "sort": "new",
  "maxPostsPerPublication": 25,
  "includeBodyText": false
}
```

#### Input fields

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `publications` | `string[]` | required | Substack handles (`astralcodexten`), Substack URLs, custom domains (`https://www.lennysnewsletter.com`), or direct post URLs (`https://.../p/<slug>`). |
| `sort` | `"new" \| "top"` | `"new"` | Sort archive posts by newest or top/most popular. |
| `maxPostsPerPublication` | `integer` | `25` | Maximum posts to deliver per publication (`1–500`), paginated automatically via Substack cursor pagination. |
| `includeBodyText` | `boolean` | `false` | Fetch full plain-text body for each post. Free posts return full text; paywalled posts return preview text and `isPaywalled: true`. |
| `search` | `string` | — | Optional search query filter passed to the Substack archive API. |
| `since` | `string` | — | Optional ISO date/timestamp lower bound (e.g. `2026-01-01`). |
| `until` | `string` | — | Optional ISO date/timestamp upper bound (e.g. `2026-12-31`). |

### Output example (v1 Dataset)

```json
{
  "publication": "astralcodexten",
  "publicationName": "Astral Codex Ten",
  "publicationUrl": "https://www.astralcodexten.com",
  "postId": "226572858",
  "slug": "book-review-contest-2026-winners",
  "title": "Book Review Contest 2026 Winners",
  "subtitle": "Congratulations to all finalists",
  "postUrl": "https://www.astralcodexten.com/p/book-review-contest-2026-winners",
  "authorName": "Scott Alexander",
  "authorHandle": "astralcodexten",
  "publishedAt": "2026-11-27T20:32:19.335Z",
  "isPaywalled": false,
  "audience": "everyone",
  "wordCount": 1327,
  "likesCount": 127,
  "commentsCount": 54,
  "restacksCount": 4,
  "coverImageUrl": "https://substack-post-media.s3.amazonaws.com/public/images/...",
  "tags": [],
  "excerpt": "...",
  "bodyText": null,
  "scrapedAt": "2026-12-01T12:00:00.000Z"
}
```

### Pricing

- **Start fee**: `$0`
- **Per post delivered**: `$0.0006` (`$0.60 / 1,000` posts)
- **Free when empty**: Invalid publications, zero-result queries, and duplicates on resume are never charged.

### Use with AI agents via MCP

Connect this Actor directly to Claude Desktop, Cursor, Windsurf, or any MCP-compatible AI agent using Apify's hosted MCP server:

```
https://mcp.apify.com?tools=meka.im/substack-scraper
```

Example prompt: *"Fetch the 20 latest posts from astralcodexten and newsletter.pragmaticengineer.com, include body text, and summarize the top AI engineering themes."*

### Related Actors

- [Google News Scraper](https://apify.com/meka.im/google-news-scraper) — Extract Google News articles by keywords, topics, or top headlines with automatic original publisher URL decoding (`$0.60/1K`, `$0` start fee).

# Actor input Schema

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

Substack handles (e.g. astralcodexten, pragmaticengineer), publication URLs (including custom domains like https://www.lennysnewsletter.com), or direct post URLs (https://.../p/<slug>).

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

Order of posts returned from each publication archive.

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

Maximum number of posts to deliver per publication (1–500). Uses native cursor pagination.

## `includeBodyText` (type: `boolean`):

Fetch full plain-text body for each post. Free posts return full text; paywalled posts return available preview text without failing and set isPaywalled: true.

## `search` (type: `string`):

Optional keyword filter passed to the Substack archive search.

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

Optional ISO date or timestamp lower bound (e.g. 2026-01-01).

## `until` (type: `string`):

Optional ISO date or timestamp upper bound (e.g. 2026-12-31).

## Actor input object example

```json
{
  "publications": [
    "astralcodexten"
  ],
  "sort": "new",
  "maxPostsPerPublication": 25,
  "includeBodyText": false
}
```

# Actor output Schema

## `posts` (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("meka.im/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"] }

# Run the Actor and wait for it to finish
run = client.actor("meka.im/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"
  ]
}' |
apify call meka.im/substack-scraper --silent --output-dataset

```

## MCP server setup

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