# Substack Scraper: Newsletter Posts & Archives (`arman-bd/substack-newsletter-scraper`) Actor

Scrape any Substack publication's public feed: post titles, subtitles, full content, author, publish date, word count and paywall status. Slugs, substack.com URLs and custom domains all work.

- **URL**: https://apify.com/arman-bd/substack-newsletter-scraper.md
- **Developed by:** [Arman Hossain](https://apify.com/arman-bd) (community)
- **Categories:** News, Social media, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.56 / 1,000 post scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Substack Scraper: Newsletter Posts & Archives

![Substack Scraper: Every post from a Substack feed as clean text, title, subtitle, author, word count and paywall status](https://api.apify.com/v2/key-value-stores/ZQOcNAOHrIgTacAmy/records/substack-newsletter-scraper.jpg)

**Substack Scraper** reads the public feed of any Substack publication and returns one structured record per post, title, subtitle, author, publish date, the full body as clean text, word count, cover image, podcast audio and whether the post is a paywalled preview.

Every Substack publication serves RSS at `/feed`, and Substack puts the entire post body in it. This Actor reads that feed directly: **no proxy setup, no browser, no credentials to manage.** Cloudflare sits in front of Substack but does not challenge feed requests, a plain HTTP GET with an ordinary User-Agent returns 200 every time.

**Agent skill: [SKILL.md](https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/substack-newsletter-scraper.md)**

```
https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/substack-newsletter-scraper.md
```

### What you get

| Output field | Meaning |
|---|---|
| `publication` | The publication's slug, or its custom domain if it has moved off substack.com |
| `feedUrl`, `feedTitle` | Feed that was actually read after redirects, and the publication's display name |
| `postId` | Substack's `guid` for the post, stable, and equal to the canonical post URL |
| `title`, `subtitle` | Post headline and the one-line subtitle Substack shows beneath it |
| `author` | Byline from `dc:creator` |
| `publishedAt` | Publish time, always ISO-8601 |
| `link` | Canonical post URL |
| `contentText` | Full post body as clean plain text, HTML stripped, entities decoded |
| `contentHtml` | Substack's original markup, when you ask to keep it |
| `isPaywalled` | `true` when the feed carries only a subscriber preview of the post |
| `wordCount` | Words in `contentText`, a quick way to spot previews and short notes |
| `imageUrl` | Cover image from the post's image enclosure, or the first image in the body |
| `audioUrl` | MP3 enclosure, present on podcast and voiceover posts |
| `scrapedAt` | Run timestamp |

A `RUN_SUMMARY` record in the key-value store holds per-run counts, a per-publication breakdown including paywalled counts, the filters used, and any publication that failed.

### Common use cases

- **Track thought leaders.** Follow a shortlist of writers and get every new post as structured data.
- **Competitive newsletter monitoring.** Watch what rival publications ship, how often, and how long.
- **Research corpora.** Build a text dataset of long-form writing for analysis or retrieval.
- **Newsroom and PR.** Spot stories breaking in newsletters before they reach the trade press.
- **Content recommendation.** Index posts by author, subtitle and body for a discovery feed.

### Quick start

Two publications, everything their feeds hold:

```json
{
 "publications": ["astralcodexten", "newsletter.pragmaticengineer.com"]
}
```

Mixed input, slugs, subdomains, post links and custom domains all resolve to the same feed:

```json
{
 "publications": [
 "noahpinion",
 "bariweiss.substack.com",
 "https://www.thefp.com",
 "https://newsletter.pragmaticengineer.com/p/formal-methods-with-hillel-wayne"
 ],
 "maxPostsPerPublication": 10
}
```

A cheap scheduled sweep that only picks up what is new:

```json
{
 "publications": ["oneusefulthing", "construction-physics"],
 "sinceDate": "2026-08-01",
 "includeContent": false
}
```

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `publications` | array | - | **Required.** Slugs, `{slug}.substack.com` URLs, post links or custom domains. Mixed input is fine. |
| `maxPostsPerPublication` | integer | `0` | Cap saved posts per publication, applied **after** the date filter. `0` = everything the feed carries. |
| `sinceDate` | string | `""` | Keep only posts published after this date. `2026-01-01` or a full ISO-8601 timestamp. |
| `includeContent` | boolean | `true` | Include the post body in `contentText`. Off gives a far smaller dataset. |
| `stripHtmlTags` | boolean | `true` | On, bodies are plain text only. Off additionally keeps Substack's markup in `contentHtml`. |

Because the feed holds 20 posts, `maxPostsPerPublication` above 20 has no effect.

### Output example

```json
{
 "publication": "newsletter.pragmaticengineer.com",
 "feedUrl": "https://newsletter.pragmaticengineer.com/feed",
 "feedTitle": "The Pragmatic Engineer",
 "postId": "https://newsletter.pragmaticengineer.com/p/formal-methods-with-hillel-wayne",
 "title": "Formal methods with Hillel Wayne",
 "subtitle": "Hillel Wayne explains why formal methods like TLA+ matter, how they help build reliable software, and whether AI will finally bring formal verification into the mainstream",
 "author": "Gergely Orosz",
 "publishedAt": "2026-07-29T16:22:31.000Z",
 "link": "https://newsletter.pragmaticengineer.com/p/formal-methods-with-hillel-wayne",
 "contentText": "Stream the latest episode\n\nListen and watch now on YouTube, Apple and Spotify …",
 "contentHtml": null,
 "isPaywalled": false,
 "wordCount": 1643,
 "imageUrl": "https://substackcdn.com/image/fetch/…/substack-post-media.s3.amazonaws.com/public/images/…jpeg",
 "audioUrl": "https://api.substack.com/feed/podcast/208490793/39e73f549d0e5b122bbc9dfe29a9b11a.mp3",
 "scrapedAt": "2026-08-06T11:47:48.866Z"
}
```

### Finding a publication slug

Open the publication and look at the address bar:

| URL you see | What to pass |
|---|---|
| `astralcodexten.substack.com` | `astralcodexten` |
| `astralcodexten.substack.com/p/some-post` | `astralcodexten` |
| `newsletter.pragmaticengineer.com` | `newsletter.pragmaticengineer.com` |
| `www.thefp.com/p/some-post` | `www.thefp.com` |

You can paste any of them verbatim, the Actor reduces a URL to its origin and appends `/feed` itself. Many publications have moved from `{slug}.substack.com` to their own domain; the old subdomain still 301s to the new one, and the redirect is followed. If two of your inputs land on the same feed after redirects, the second is skipped rather than scraped twice.

### API example

```bash
curl -X POST "https://api.apify.com/v2/acts/arman-bd~substack-newsletter-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{
 "publications": ["astralcodexten", "noahpinion"],
 "maxPostsPerPublication": 5,
 "includeContent": false
 }'
```

### JavaScript example

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_TOKEN' });
const run = await client.actor('arman-bd/substack-newsletter-scraper').call({
 publications: ['astralcodexten', 'newsletter.pragmaticengineer.com'],
 sinceDate: '2026-08-01',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const post of items) console.log(`${post.publishedAt}, ${post.title} (${post.wordCount} words)`);
```

### Limits and behaviour

- **This is not the full archive.** Substack's `/feed` returns exactly the 20 most recent posts, and there is no pagination parameter on it. Every publication tested, large and small, returned 20. To go deeper you need the publication's sitemap or archive pages, which this Actor deliberately does not touch. Run it on a schedule and you build the archive forward from today.
- **Paywalled posts come back as previews.** Substack truncates subscriber-only posts in the feed and closes them with a "Read more" link. The Actor detects that and sets `isPaywalled: true`; `contentText` then holds only the free preview. Nothing here bypasses a paywall.
- **No Cloudflare problem.** Substack is behind Cloudflare, but `/feed` is not challenged. Requests with an ordinary User-Agent, a bot-shaped User-Agent, and no User-Agent at all all returned HTTP 200 during testing.
- **Custom domains are handled.** `{slug}.substack.com` 301s to the publication's own domain; redirects are followed and the final URL is reported in `feedUrl`.
- **One failure never kills the run.** An unknown slug returns 404, is logged into `RUN_SUMMARY.failures`, and the run continues. The Actor only errors out if *every* publication fails.
- **Transient errors are retried.** 429 and 5xx get three attempts with backoff, honouring `Retry-After`.
- **One request per second** between publications, with a 45-second timeout each.

### FAQ

**Do I need a Substack account?** No. You supply no credentials.

**Can I get posts older than the last 20?** Not from this Actor. The feed simply does not contain them.

**Does it include paid posts?** It includes the free preview Substack publishes for them, flagged with `isPaywalled: true`. It cannot and does not retrieve subscriber-only text.

**Why is `subtitle` null?** Substack writes a literal `.` as the description when a post has no subtitle; that is normalised to `null` rather than passed through.

**Why does `publication` show a domain rather than my slug?** Because that publication has migrated to its own domain, and the record reflects where the content actually lives. `feedUrl` shows the same thing.

**How many publications can I pass at once?** There is no hard cap. Feeds are read sequentially at one per second, so hundreds per run is normal.

**Can I integrate it with something else?** Yes, Apify API, client libraries, webhooks, scheduled runs, dataset exports (JSON/CSV/Excel) or MCP. Output is structured JSON.

# Actor input Schema

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

Substack publications to read. A bare slug ('astralcodexten'), a full '{slug}.substack.com' URL, a link to any single post, or a custom domain ('newsletter.pragmaticengineer.com') all resolve to the same feed. A slug that does not exist returns HTTP 404 and is recorded in RUN\_SUMMARY.failures.

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

Cap on saved posts per publication, applied after the date filter. The feed only ever holds 20 posts, so anything above 20 has no effect. 0 = save everything the feed carries.

## `sinceDate` (type: `string`):

Keep only posts published after this moment. Accepts a plain date ('2026-01-01') or a full ISO-8601 timestamp ('2026-01-01T00:00:00Z'). Useful for scheduled runs that should only pick up what is new.

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

Include the post body in 'contentText'. Substack inlines the entire post in the feed, so a busy publication can be a megabyte or two. turn this off if you only need titles, dates and links.

## `stripHtmlTags` (type: `boolean`):

On (default), post bodies are delivered as clean plain text and 'contentHtml' is null. Off additionally keeps Substack's original markup in 'contentHtml'. needed if you want the inline images, footnotes and links.

## Actor input object example

```json
{
  "publications": [
    "noahpinion",
    "https://www.thefp.com",
    "oneusefulthing"
  ],
  "maxPostsPerPublication": 0,
  "sinceDate": "2026-01-01",
  "includeContent": true,
  "stripHtmlTags": true
}
```

# Actor output Schema

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

Every record the run produced.

## `runsummary` (type: `string`):

The RUN\_SUMMARY record from the run's key-value store.

# 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",
        "newsletter.pragmaticengineer.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arman-bd/substack-newsletter-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",
        "newsletter.pragmaticengineer.com",
    ] }

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

```

## MCP server setup

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