# Substack Posts Scraper - Newsletter Posts, Dates & React (`captainhandsome/substack-posts-scraper`) Actor

Read public Substack publications by slug or domain (newest posts with title, subtitle, date, audience, reactions, comments, wordcount and URL) and search posts across Substack by keyword. Public web endpoints only; no login, no API key, no per-run start fee. $2 per 1,000 posts.

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

## Pricing

$2.00 / 1,000 results

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 Posts Scraper — publication archives and keyword search

Read any public Substack publication: its newest posts, or the posts matching keywords
inside that publication's own archive. No login, no API key, no per-run start fee.

### What you can do

1. **Newest posts of a publication** — give a subdomain (`noahpinion`), a Substack URL
   (`https://noahpinion.substack.com`) or a custom domain (`https://www.noahpinion.blog`) and
   get its latest posts: title, subtitle, author, date, audience, reactions, comments,
   restacks, wordcount, cover image and canonical URL.
2. **Keyword search inside a publication** — pass keywords and the Actor uses the
   publication's own archive search, newest match first, tagged with the keyword that found it.
3. **Several publications at once** — up to 50 publications per run; duplicates are removed.

### Output

One row per post.

| Field | Meaning |
| --- | --- |
| `rowType` | Always `post` |
| `postId`, `slug`, `url` | Substack post id, slug and canonical URL |
| `title`, `subtitle` | Post titles |
| `authorName` | Author of the post, from the publication's byline |
| `publicationName`, `publicationSlug`, `publicationUrl` | Which publication the post belongs to |
| `postDate` | Publication date, ISO 8601 |
| `type`, `audience` | Post type (newsletter, podcast, …) and `everyone` / `only_paid` |
| `wordcount`, `reactionCount`, `commentCount`, `restackCount` | Counts at scrape time |
| `description` | Short description or subtitle, truncated to 600 characters |
| `coverImage` | Cover image URL |
| `foundBy`, `searchTerm` | `publication` (newest posts) or `search`, plus the keyword used |
| `scrapedAt` | When the row was collected |

### Input examples

Newest 20 posts of two publications:

```json
{ "publications": ["noahpinion", "https://www.thefp.com"], "maxPostsPerPublication": 20 }
```

Posts about a topic inside a publication:

```json
{ "publications": ["noahpinion"], "searchTerms": ["interest rates", "housing"], "maxPostsPerTerm": 25 }
```

### Pricing

Pay per result: **$0.002 per row** ($2 per 1,000 posts). No per-run start fee. A run that
returns nothing is not billed per result.

### Honest limits

- Reads only public web endpoints: `/api/v1/archive` on each publication's own domain.
  No login, no cookies, no paywall bypass.
- **Post body text is not included.** This Actor returns metadata and URLs; free posts can be
  read at the returned URL. Paywalled posts are marked `audience: only_paid` and their text is
  not accessible without a subscription.
- Search is **per publication**, using that publication's own archive search. There is no
  cross-Substack keyword search in this Actor (Substack's public endpoint for it returns empty
  results, so it is not advertised).
- Counts (reactions, comments, restacks) are a point-in-time snapshot and change over time.
- Newest-first only: there is no date filter, so reads take the most recent posts.
- A private or nonexistent publication returns nothing and is logged and skipped. If nothing
  at all could be read, the run fails loudly instead of charging.

# Actor input Schema

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

Publications to read: a subdomain like 'noahpinion', a URL like https://noahpinion.substack.com, or a custom domain like https://www.noahpinion.blog. Defaults to one public newsletter so a run with no input still returns data.

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

Used when no keywords are given: how many of the newest posts to return from each publication. Each row is one billed result.

## `searchTerms` (type: `array`):

When set, each publication's own archive search is used and up to 'Max posts per keyword' matching posts are returned per publication per keyword, newest first. Leave empty to read the newest posts instead.

## `maxPostsPerTerm` (type: `integer`):

How many matching posts to take for each keyword in each publication.

## Actor input object example

```json
{
  "publications": [
    "noahpinion"
  ],
  "maxPostsPerPublication": 10,
  "searchTerms": [],
  "maxPostsPerTerm": 10
}
```

# Actor output Schema

## `items` (type: `string`):

Post rows in the default dataset.

# 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": [
        "noahpinion"
    ],
    "maxPostsPerPublication": 10,
    "searchTerms": [],
    "maxPostsPerTerm": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("captainhandsome/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": ["noahpinion"],
    "maxPostsPerPublication": 10,
    "searchTerms": [],
    "maxPostsPerTerm": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("captainhandsome/substack-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": [
    "noahpinion"
  ],
  "maxPostsPerPublication": 10,
  "searchTerms": [],
  "maxPostsPerTerm": 10
}' |
apify call captainhandsome/substack-posts-scraper --silent --output-dataset

```

## MCP server setup

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