# Substack Posts & Newsletters Scraper (`whthpnd/substack-newsletters-posts-scraper`) Actor

Fast, proxy-free Substack scraper. Extract posts, subtitles, authors, publication dates, likes, comments, restacks, word counts, and full article text from any Substack newsletter or custom domain.

- **URL**: https://apify.com/whthpnd/substack-newsletters-posts-scraper.md
- **Developed by:** [DirectAPI Labs](https://apify.com/whthpnd) (community)
- **Categories:** News, Social media, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.70 / 1,000 result items

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 Posts & Newsletters Scraper

Fast, **proxy-free** scraper for **Substack** newsletters and custom-domain Substack publications (`256 MB` RAM). Extract recent or top posts, subtitles, authors, word counts, audience tiers, likes, comments, restacks, and optional plain-text article bodies via direct cursor pagination.

### Why Use This Actor?

- **Works With Custom Domains & `*.substack.com`:** Paste `https://www.lennysnewsletter.com`, `https://newsletter.pragmaticengineer.com`, or any standard Substack URL.
- **High-Signal Engagement Metrics:** Captures `reactionCount`, `commentCount`, `restacks`, `wordCount`, `audience` (`everyone` vs `only_paid`), `authors`, and `coverImage`.
- **Optional Full Article Body:** Enable `includeFullText` to retrieve cleaned plain-text `bodyText` for LLM/RAG ingestion and newsletter monitoring.
- **Zero Headless Browser & Zero Proxies:** Fast JSON API cursor extraction on `256 MB` RAM.

### Input Parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `publications` | Array | `["https://newsletter.pragmaticengineer.com", ...]` | Substack URLs, subdomains, or custom domains. |
| `sortBy` | String | `"new"` | Sort order (`"new"` or `"top"`). |
| `searchQuery` | String | `""` | Optional keyword filter across title, subtitle, and preview text. |
| `freeOnly` | Boolean | `false` | Keep only free posts (`audience == "everyone"`). |
| `maxPosts` | Integer | `50` | Maximum posts to return (`1`–`200`). |
| `includeFullText` | Boolean | `false` | Fetch and clean full plain-text article body (`bodyText`). |

#### Example Input

```json
{
  "publications": [
    "https://newsletter.pragmaticengineer.com",
    "https://www.lennysnewsletter.com"
  ],
  "sortBy": "new",
  "freeOnly": true,
  "maxPosts": 30,
  "includeFullText": false
}
```

### Output Format

Each dataset item represents one Substack post:

```json
{
  "id": 152048112,
  "publication": "https://newsletter.pragmaticengineer.com",
  "title": "Inside Engineering Productivity at Scale",
  "subtitle": "Benchmarks and tooling choices across 50+ tech teams",
  "slug": "inside-engineering-productivity",
  "url": "https://newsletter.pragmaticengineer.com/p/inside-engineering-productivity",
  "publishedAt": "2026-11-21T13:00:00.000Z",
  "audience": "everyone",
  "authors": ["Gergely Orosz"],
  "reactionCount": 412,
  "commentCount": 38,
  "restacks": 29,
  "wordCount": 2840,
  "coverImage": "https://substackcdn.com/image/fetch/...",
  "previewText": "Over the past quarter we surveyed engineering leaders..."
}
```

### Pricing & Cost Efficiency

- **Pricing model:** Pay-Per-Event (`$0.00005` per Actor start + `$0.002` per post = `$2.00` per 1,000 posts).
- **Compute footprint:** Default `256 MB` RAM (~`$0.0001` platform compute per run) with **no proxies needed**.

### Integrations & Automation

Export to JSON/CSV/Excel or connect directly into **n8n**, **Make**, **Clay**, **Notion**, AI digest workflows, or **MCP / AI Agents** via the Apify API.

### FAQ

**Can this bypass Substack paywalls on subscriber-only posts?**
No. For `only_paid` articles it extracts metadata, preview text, engagement stats, and free preview sections only.

**Does it handle custom domains hosted on Substack?**
Yes — pass any custom-domain Substack newsletter URL and it resolves the Substack archive cursor endpoint automatically.

**How is `bodyText` returned when `includeFullText` is enabled?**
HTML tags are cleanly stripped into readable plain text (`bodyText`) ready for summarization or vector indexing.

**Are proxies required?**
No — runs directly from Apify Cloud IPs.

# Actor input Schema

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

Substack newsletter URLs (e.g., https://newsletter.pragmaticengineer.com, https://www.lennysnewsletter.com) or subdomain slugs (e.g., stratechery).

## `sortBy` (type: `string`):

Fetch newest or top posts from each newsletter.

## `searchQuery` (type: `string`):

Optional case-insensitive keyword filter across post title, subtitle, and preview text.

## `freeOnly` (type: `boolean`):

Only return posts available to everyone (audience == 'everyone').

## `maxPosts` (type: `integer`):

Maximum total number of posts to extract across all newsletters.

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

Fetch each post endpoint to extract full plain-text bodyText (adds one lightweight request per post).

## Actor input object example

```json
{
  "publications": [
    "https://newsletter.pragmaticengineer.com",
    "https://www.lennysnewsletter.com"
  ],
  "sortBy": "new",
  "freeOnly": false,
  "maxPosts": 50,
  "includeFullText": 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": [
        "https://newsletter.pragmaticengineer.com",
        "https://www.lennysnewsletter.com"
    ]
};

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,whthpnd/substack-newsletters-posts-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/RQgxxlSF3yoW5F5ee/builds/x4H9q18qbxg1BFcrd/openapi.json
