# Substack Publication Scraper (`bgfc97/substack-publication-scraper`) Actor

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

## Pricing

from $1.50 / 1,000 post scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Publication Scraper

Pull posts from **any public Substack publication** — no API key, no login. The Actor uses Substack's own open JSON feed (`/api/v1/posts`), so you get clean, structured data straight from the source. Point it at a newsletter and get back **35+ fields per post**, plus publication metadata.

### What you get

For **every post**:

- **Content:** `title`, `subtitle`, `social_title`, `description`, `truncated_body_text`, `slug`, `url`, `cover_image`
- **Timing:** `post_date`, `updated_at`, `language`
- **Engagement:** `reaction_count`, `reactions` (full map), `comment_count`, `child_comment_count`, `restacks`
- **Access / type:** `type`, `audience`, `is_paid`, `is_free`, `is_preview`
- **Reading:** `wordcount`, `reading_time_minutes`
- **Taxonomy:** `tags`, `section_id`, `publication_id`, `id`
- **Authors:** `authors` (names) **and** `authors_detailed` (name, handle, **bio**, photo, Twitter)
- **Audio / podcast:** `has_audio`, `audio_url`, `has_podcast`, `podcast_url`, `podcast_duration`
- **Full body (optional):** `body_html` and plain-text `body_text` — enable `includeBody`
- **Publication:** a `publicationMeta` object on each row — `name`, `description`, `author`, `logo_url`, `language`, `url`

### What it's good for

- Tracking a competitor's or your own publishing cadence and engagement (likes, comments, restacks).
- Building a content dataset (titles, dates, tags, wordcount, full text) for analysis or LLM pipelines.
- Monitoring several newsletters at once and exporting to CSV / Excel / JSON / API.

### Input

| Field | Type | Description |
|---|---|---|
| `publications` | array of strings | **Required.** One or more publications. Accepts a bare subdomain (`platformer`), a full URL (`https://newsletter.pragmaticengineer.com`) or a custom domain (`www.astralcodexten.com`). Normalized for you. |
| `maxPosts` | integer | Max posts to fetch per publication. Default `50` (1–5000). Paginates until reached or the archive ends. |
| `includePublicationMeta` | boolean | Attach `publicationMeta` to every post (one extra request per publication). Default `true`. |
| `includeBody` | boolean | Also fetch the full article body (`body_html` + `body_text`). One extra request per post, so runs take longer. Default `false`. |
| `maxConcurrency` | integer | How many publications to scrape in parallel. Default `3` (1–10). |
| `timeoutSecs` | integer | Timeout per request in seconds. Default `30` (5–120). |
| `maxRetries` | integer | Retries per failed request (network error, timeout, 429, 5xx) with exponential backoff. Default `3` (0–8). |

#### Example input

```json
{
  "publications": [
    "https://newsletter.pragmaticengineer.com",
    "platformer",
    "www.astralcodexten.com"
  ],
  "maxPosts": 25,
  "includeBody": false,
  "maxConcurrency": 3
}
```

### Output

One dataset item per post:

```json
{
  "publication": "newsletter.pragmaticengineer.com",
  "title": "The Pulse: Firebase’s global outage & poor response",
  "subtitle": "Also: OpenAI’s platform play…",
  "slug": "the-pulse-firebases-global-outage",
  "url": "https://newsletter.pragmaticengineer.com/p/the-pulse-firebases-global-outage",
  "post_date": "2026-10-01T16:43:19.985Z",
  "type": "newsletter",
  "audience": "only_paid",
  "reaction_count": 53,
  "comment_count": 3,
  "authors": ["Gergely Orosz"],
  "description": "…",
  "cover_image": "https://substackcdn.com/image/fetch/…png",

  "id": 218367831,
  "publication_id": 458709,
  "section_id": 24961,
  "social_title": "The Pulse: Firebase’s global outage & poor response",
  "restacks": 1,
  "child_comment_count": 2,
  "reactions": { "❤": 53 },
  "is_paid": true,
  "is_free": false,
  "is_preview": true,
  "wordcount": 2889,
  "reading_time_minutes": 14,
  "language": "en",
  "updated_at": "2026-10-03T20:34:07.897Z",
  "tags": ["Google", "OpenAI"],
  "authors_detailed": [
    { "name": "Gergely Orosz", "handle": "pragmaticengineer", "bio": "Big Tech and startups…", "photo_url": "https://…", "twitter_screen_name": "GergelyOrosz" }
  ],
  "has_audio": true,
  "audio_url": null,
  "has_podcast": false,
  "body_html": null,
  "body_text": null,
  "publicationMeta": {
    "name": "The Pragmatic Engineer",
    "description": "Big Tech and startups, from the inside…",
    "author": "Gergely Orosz",
    "logo_url": "https://substackcdn.com/image/…300x300.png",
    "language": "en-us",
    "url": "https://newsletter.pragmaticengineer.com"
  }
}
```

If a publication can't be read (private, invite-only, wrong host, network error), the Actor pushes a single row `{ "publication": "<host>", "error": "<reason>" }` and moves on to the next one — it never crashes the whole run.

### Notes

- Some publications are private or **invite-only** and will return an error row instead of posts.
- `audience` values from Substack include `everyone` (free), `only_paid` and `only_free`. `is_paid` / `is_free` are convenience flags derived from it.
- The feed is ordered newest-first, so `maxPosts` gives you the most recent N posts.
- `includeBody` returns the full text of **free/public** posts; for paid posts it returns the public preview Substack serves without login.
- Robust by default: failed requests are retried with exponential backoff before an error row is emitted.

### Pricing

Pay-per-result: you are charged one **dataset-item** event per post returned. Error rows are not charged as posts, and publication metadata / full-body fetching do not add charges.

# Actor input Schema

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

One or more Substack publications to scrape. Accepts a bare subdomain (e.g. "platformer"), a full URL (e.g. "https://newsletter.pragmaticengineer.com") or a custom domain (e.g. "www.astralcodexten.com"). The host is normalized automatically.

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

Maximum number of posts to fetch from each publication. The scraper paginates until this many are collected or the archive ends (1-5000).

## `includePublicationMeta` (type: `boolean`):

Attach a compact publicationMeta object (name, description, author, logo, language, URL) to every post. One extra request per publication (reads the public RSS feed).

## `includeBody` (type: `boolean`):

Also fetch the full article body for each post (body_html and a plain-text body_text). Free/public posts return the full text; paid posts return the public preview. This makes one extra request per post, so runs take longer.

## `maxConcurrency` (type: `integer`):

How many publications to scrape at the same time (1-10).

## `timeoutSecs` (type: `integer`):

Timeout for each request to the Substack API (5-120).

## `maxRetries` (type: `integer`):

How many times to retry a failed request (network error, timeout, HTTP 429 or 5xx) with exponential backoff (0-8).

## Actor input object example

```json
{
  "publications": [
    "https://newsletter.pragmaticengineer.com"
  ],
  "maxPosts": 50,
  "includePublicationMeta": true,
  "includeBody": false,
  "maxConcurrency": 3,
  "timeoutSecs": 30,
  "maxRetries": 3
}
```

# Actor output Schema

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bgfc97/substack-publication-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"] }

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

```

## MCP server setup

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