# Substack Newsletter & LLM Markdown Extractor (`edenwood.ai/substack-extractor`) Actor

Extract clean, structured Substack newsletter posts, authors, word counts, reading time, audio enclosures, paywall flags, and LLM-ready Markdown directly from public Substack RSS feeds — zero proxies, zero CAPTCHAs.

- **URL**: https://apify.com/edenwood.ai/substack-extractor.md
- **Developed by:** [EdenWood](https://apify.com/edenwood.ai) (community)
- **Categories:** News, AI, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 post extracteds

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 Newsletter & LLM Markdown Extractor

Extract clean, structured **Substack newsletter posts**, authors, publish dates, word counts, reading time estimates, cover images, podcast audio enclosures, paywall flags, and **LLM-ready Markdown** directly from any public Substack publication or custom domain.

Built for **AI/RAG knowledge bases, content researchers, newsletter aggregators, n8n/Make workflows, and MCP AI agents**.

***

### Why Choose This Substack Scraper?

- **Clean Markdown for LLMs & RAG:** Strips noisy newsletter HTML, tracking pixels, and scripts into clean `contentMarkdown` and `contentPlain` with configurable truncation (`maxContentChars`).
- **Works with Custom Domains, Slugs & Article Links:** Paste `"https://www.lennysnewsletter.com"`, `"https://newsletter.pragmaticengineer.com"`, a direct `/feed` URL, or a bare Substack slug like `"lenny"` — automatically normalized.
- **Smart Paywall & Podcast Detection:** Computes `wordCount`, `readingTimeMinutes`, `coverImageUrl`, `audioEnclosureUrl`, and `isLikelyPaywalled` (audio-aware so podcast episodes aren't falsely flagged).
- **Zero Proxies, Zero CAPTCHAs, Sub-Second Speed:** Uses public Substack RSS XML feeds directly — extracts 40 posts in under 1 second on 256 MB RAM.

***

### Pay-Per-Event Pricing

- **`post-extracted`:** `$2.00 / 1,000 posts` (`$0.002` per post extracted)
- **`apify-actor-start`:** `$0.00005` platform startup fee
- Automatic cross-feed deduplication before charging and strict adherence to your `maxTotalChargeUsd` limit.

***

### Input Example

```json
{
  "publications": [
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com"
  ],
  "keywords": [],
  "publishedAfter": "2026-10-01",
  "includeFullContent": true,
  "maxContentChars": 25000,
  "maxPostsPerPublication": 20,
  "maxTotalPosts": 100
}
```

***

### Output Example

```json
{
  "postId": "https://www.lennysnewsletter.com/p/example",
  "publicationName": "Lenny's Newsletter",
  "publicationUrl": "https://www.lennysnewsletter.com",
  "feedUrl": "https://www.lennysnewsletter.com/feed",
  "title": "How Top AI Teams Ship Faster",
  "subtitle": "Lessons from 50 product leaders",
  "author": "Lenny Rachitsky",
  "url": "https://www.lennysnewsletter.com/p/example",
  "publishedAt": "2026-11-17T18:02:02Z",
  "wordCount": 1756,
  "readingTimeMinutes": 9,
  "isLikelyPaywalled": false,
  "coverImageUrl": "https://...",
  "audioEnclosureUrl": null,
  "contentMarkdown": "## Key Takeaways\n...",
  "contentPlain": "Key Takeaways ..."
}
```

***

### Use via Python API or MCP AI Agents

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("edenwood.ai/substack-extractor").call(run_input={
    "publications": ["https://www.lennysnewsletter.com"],
    "maxPostsPerPublication": 10
})
posts = list(client.dataset(run["defaultDatasetId"]).iterate_items())
```

***

### FAQ

- **How many posts per publication are returned?** Public Substack RSS feeds expose up to the **20 most recent posts** per publication, ideal for scheduled daily/weekly monitoring and real-time AI newsletter digests.
- **Does it bypass paywalls?** No — it strictly extracts publicly published RSS content and sets `isLikelyPaywalled: true` when a post is a subscriber-only preview.
- **Can I run it on a schedule for an AI digest?** Yes — combine Apify Schedules with `publishedAfter` or deduplication to feed fresh Substack Markdown straight into Notion, Slack, or your vector database.

# Actor input Schema

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

List of Substack publication URLs (e.g. 'https://www.lennysnewsletter.com'), direct /feed URLs, or Substack subdomains (e.g. 'lenny').

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

Case-insensitive keywords matched against post title, subtitle, or body. Leave empty to extract all recent posts.

## `publishedAfter` (type: `string`):

Only return posts published on or after this UTC date (format: YYYY-MM-DD).

## `includeFullContent` (type: `boolean`):

Include contentMarkdown and contentPlain fields (wordCount, readingTimeMinutes, and isLikelyPaywalled are always computed).

## `maxContentChars` (type: `integer`):

Truncate contentMarkdown and contentPlain to keep payloads compact for AI agents/RAG.

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

Maximum post-filter posts per publication (Substack public RSS feeds expose up to ~20 recent posts).

## `maxTotalPosts` (type: `integer`):

Hard ceiling on total posts extracted across all publications.

## Actor input object example

```json
{
  "publications": [
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com"
  ],
  "keywords": [],
  "publishedAfter": "",
  "includeFullContent": true,
  "maxContentChars": 25000,
  "maxPostsPerPublication": 20,
  "maxTotalPosts": 100
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `summary` (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://www.lennysnewsletter.com",
        "https://newsletter.pragmaticengineer.com"
    ]
};

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,edenwood.ai/substack-extractor"
        }
    }
}
```

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/iz2prhJQcEq0SxqJh/builds/xrsvQ67hLtY4YDM7C/openapi.json
