# Substack Scraper: Posts, Full Text, Likes & Comments (`spellzcode/substack-posts-scraper`) Actor

Get the posts of any Substack newsletter: title, subtitle, date, authors, full text of free posts, likes, comment and restack counts, tags and links. Filter by date and keywords. Works with custom domains. Pay only for posts returned.

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

## Pricing

from $1.40 / 1,000 post returneds

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: Posts, Full Text, Likes & Comments

Enter Substack newsletters and get their posts in one clean table: title, date, authors, the full text of free posts, and how many likes, comments and restacks each one got.

It reads the public feed every Substack newsletter publishes about itself, so it needs no login and no browser, and it works for newsletters on their own domain as well as on `substack.com`.

**You pay only for posts returned**, after your filters are applied. Newsletters that are not found cost nothing.

### What you get for each post

| Field | What it is |
|---|---|
| `title`, `subtitle`, `description` | The post's headline, subtitle and summary |
| `url`, `newsletter` | Link to the post, and the newsletter it belongs to |
| `postedAt` | Publication date in standard format |
| `authors` | Everyone credited on the post |
| `text` | The post as plain text, with headings and list items on their own lines |
| `paywalled`, `textIsPreview` | `true` when the post is for paying subscribers. For those, `text` holds only the public preview |
| `likes`, `comments`, `restacks` | Engagement counts |
| `wordCount`, `tags`, `section`, `type` | Length, the newsletter's own tags and section, and whether it is a newsletter post, podcast or thread |
| `coverImage` | Address of the cover image |

### Input

```json
{
  "newsletters": ["astralcodexten", "https://www.noahpinion.blog"],
  "maxPostsPerNewsletter": 50,
  "postedWithinDays": 30,
  "keywords": ["ai", "economy"],
  "freeOnly": false,
  "includeContent": true
}
```

Paste a newsletter's address, the address of any of its posts, or just its Substack name. Newsletters that could not be found are listed in the run's `NOT_FOUND` record.

### Typical uses

- **Research and AI pipelines:** collect a writer's whole free archive as clean text.
- **Monitoring:** run daily with `postedWithinDays` set to 1 to get only new posts from a list of newsletters.
- **Content and competitor analysis:** see which posts drew the most likes and comments, and how often a newsletter publishes.
- **Curation:** pull posts matching your keywords across many newsletters.

### Pricing

$2.00 per 1,000 posts ($0.002 each). One charge per post returned, with or without its text.

The latest 50 posts of a newsletter cost $0.10. A 1,200-post archive costs $2.40.

Each run also has a start charge of $0.00005. There is no separate charge for computing time. Apify's paid plans get 10% to 30% off these prices; the Pricing tab shows yours. Apify's free plan includes $5 of credit a month, which covers 2,500 posts.

### Limits

- Posts for paying subscribers are returned with their public preview only. This tool does not log in and cannot read paid content.
- Comment texts are not included, only the number of comments.
- Subscriber counts are not public and are not returned.

### Questions

#### Can I run it on a schedule?

Yes. Save your input as a task and add an Apify schedule, for example every morning.

#### How do I get the results into Excel or Google Sheets?

Every run's results can be downloaded as Excel, CSV or JSON from the run's Output tab. Apify's integrations with Make, Zapier, n8n and Google Sheets can pass them on automatically.

#### Can I call it from my own code or from an AI agent?

Yes. The API tab has ready-made code for Python, JavaScript and cURL, and the tool can be connected to AI agents through Apify's MCP server.

#### Does it work for newsletters on a custom domain?

Yes. Paste the newsletter's own address, for example `https://www.noahpinion.blog`.

#### Something looks wrong or is missing

Open a report under the Issues tab and include the input you used.

# Actor input Schema

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

One per line. Paste a newsletter's address, such as https://www.noahpinion.blog or https://astralcodexten.substack.com, or just its Substack name (astralcodexten). The address of any of its posts works too.

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

Newest posts first. Raise it to collect a newsletter's whole archive.

## `postedWithinDays` (type: `integer`):

Optional. Keep only posts published within this many days. Run it daily with 1 to get only new posts.

## `keywords` (type: `array`):

Optional. Keep only posts whose title, subtitle, description or tags contain at least one of these words or phrases.

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

Leave out posts that are for paying subscribers. Those are otherwise returned with their public preview only.

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

Turn off for faster runs when you only need titles, dates, links and engagement counts.

## Actor input object example

```json
{
  "newsletters": [
    "astralcodexten",
    "https://www.noahpinion.blog"
  ],
  "maxPostsPerNewsletter": 10,
  "freeOnly": false,
  "includeContent": true
}
```

# Actor output Schema

## `posts` (type: `string`):

One item per post: title, date, authors, text, engagement counts and link.

# 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.noahpinion.blog"
    ],
    "maxPostsPerNewsletter": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("spellzcode/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 = {
    "newsletters": [
        "astralcodexten",
        "https://www.noahpinion.blog",
    ],
    "maxPostsPerNewsletter": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("spellzcode/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 '{
  "newsletters": [
    "astralcodexten",
    "https://www.noahpinion.blog"
  ],
  "maxPostsPerNewsletter": 10
}' |
apify call spellzcode/substack-posts-scraper --silent --output-dataset

```

## MCP server setup

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