# Substack Ultimate Scraper (`khnaami/actor-substack-scraper`) Actor

Extract clean Markdown & Plain Text articles for LLMs/AI, scrape full publication archives, reader comments, and discover newsletters by topic with no login required.

- **URL**: https://apify.com/khnaami/actor-substack-scraper.md
- **Developed by:** [khalid naami](https://apify.com/khnaami) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Ultimate Scraper (Newsletters, Full Articles, Comments & Search)

High-speed, all-in-one Substack data extraction engine on Apify. Extract **Full Article Text & Markdown** (AI-ready for LLMs, RAG, and summarization), **Entire Newsletter Archives**, **Publication Metadata & Stats**, **Engagement Metrics** (Likes, Comments, Reactions), **Reader Comments**, and **Keyword Search** without requiring a login or account.

***

### ⚡ Key Features

- 📝 **AI-Ready Full Article Text & Markdown**: Extracts the complete article plain text (clean, unbloated by HTML) and HTML body — ideal for training LLMs, feeding RAG vector databases, research analysis, and AI summarization.
- 📚 **Full Publication Archives**: Scrapes an entire newsletter's archive of articles with automated pagination across standard Substack subdomains and custom domains.
- 👥 **Author Bylines & Contact Leads**: Extract author names, handles, bios, photos, Twitter/X profiles, and contact emails found in publications.
- 💬 **Reader Comments & Community Discussions**: Extracts top-voted comments and reader thoughts on articles.
- 📊 **Engagement & Paywall Metadata**: Scrapes reaction counts (`❤`), comment counts, word count, estimated reading time, and paywall tier status (`audience: everyone` vs `only_paid`).
- 🔍 **Global Keyword Search**: Search across all of Substack by topic or industry (e.g., *artificial intelligence*, *crypto*, *macroeconomics*) to discover trending newsletters.
- 🌐 **Zero Login Required**: Operates directly via public REST endpoints without requiring a Substack account, password, or cookies.
- 🛡️ **Blazing Fast Direct API Execution**: Ultra-lightweight HTTP execution powered by `got-scraping` with Apify Proxy support.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `mode` | String | `AUTO_DETECT` | Extraction mode: `AUTO_DETECT`, `PUBLICATIONS`, `POSTS`, `COMMENTS`, `SEARCH`. |
| `targetUrls` | Array | `[...]` | List of Substack Publication URLs (or specific article URLs). |
| `searchKeywords` | Array | `[]` | Keywords to discover newsletters and articles across Substack. |
| `maxPosts` | Integer | `30` | Maximum articles to extract per newsletter (0 for full archive). |
| `maxComments` | Integer | `20` | Maximum reader comments to extract per article. |
| `extractFullText` | Boolean | `true` | Extract full article body text and markdown for AI/LLM workflows. |
| `proxyConfiguration` | Object | `{ useApifyProxy: true }` | Apify Residential proxy configuration (recommended). |

***

### 📤 Output Data Format

#### 1. Substack Article Record (AI & LLM Ready)

```json
{
  "type": "POST",
  "id": "145678901",
  "url": "https://thealgorithmicbridge.substack.com/p/why-ai-agents-matter",
  "title": "Why AI Agents Are the Next Computing Platform",
  "subtitle": "An in-depth analysis of autonomous agentic architectures.",
  "slug": "why-ai-agents-matter",
  "bodyText": "Over the past six months, the focus of generative AI has decisively shifted from static chatbots to autonomous agentic loops...",
  "publicationName": "The Algorithmic Bridge",
  "publicationUrl": "https://thealgorithmicbridge.substack.com",
  "primaryAuthor": "Alberto Romero",
  "coverImageUrl": "https://substackcdn.com/image/fetch/...",
  "likesCount": 420,
  "commentsCount": 35,
  "isPaid": false,
  "audience": "everyone",
  "wordCount": 1850,
  "readingTimeMinutes": 9,
  "publishedAt": "2026-10-08T14:00:00.000Z",
  "scrapedAt": "2026-10-09T22:45:00.000Z"
}
```

#### 2. Publication Record

```json
{
  "type": "PUBLICATION",
  "id": "thealgorithmicbridge",
  "url": "https://thealgorithmicbridge.substack.com",
  "publicationName": "The Algorithmic Bridge",
  "publicationSubdomain": "thealgorithmicbridge",
  "description": "Bridging the gap between artificial intelligence, philosophy, and society.",
  "publicationLogoUrl": "https://substackcdn.com/image/fetch/...",
  "scrapedAt": "2026-10-09T22:45:00.000Z"
}
```

***

### 💼 AI, Research & Market Intelligence Use Cases

- **AI Model Pretraining & RAG Pipelines**: Feed rich, high-quality, long-form expert essays into vector databases (Pinecone, Chroma, Qdrant) and language models.
- **Financial & Market Newsletter Sourcing**: Monitor independent equity analysts, crypto newsletters, and macro economists for real-time market signals.
- **Thought Leader & PR Prospecting**: Find influential newsletter writers in your vertical for podcast bookings, guest writing, or sponsor spots.

***

### 📄 License

Apache-2.0

# Actor input Schema

## `mode` (type: `string`):

Select Substack extraction mode, or use AUTO_DETECT.

## `targetUrls` (type: `array`):

List of Substack Publication URLs (e.g. https://pragmaticengineer.com or https://astralcodexten.substack.com) or specific post URLs.

## `searchKeywords` (type: `array`):

Keywords to discover Substack newsletters and articles across topics.

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

Maximum number of articles to extract per newsletter or search query (0 for unlimited/full archive).

## `maxComments` (type: `integer`):

Maximum reader comments to extract per article.

## `extractFullText` (type: `boolean`):

If enabled, extracts the complete article plain text and markdown for AI/LLM summarization and RAG.

## `proxyConfiguration` (type: `object`):

Select Apify Proxy or No proxy (RESIDENTIAL recommended for high-volume scraping).

## Actor input object example

```json
{
  "mode": "AUTO_DETECT",
  "targetUrls": [
    "https://thealgorithmicbridge.substack.com"
  ],
  "searchKeywords": [
    "artificial intelligence agents"
  ],
  "maxPosts": 30,
  "maxComments": 20,
  "extractFullText": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Scraped Substack records (Articles, Publications, Comments, Search Results)

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

High-level summary report and execution metrics stored in 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 = {
    "targetUrls": [
        "https://thealgorithmicbridge.substack.com"
    ],
    "searchKeywords": [
        "artificial intelligence agents"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khnaami/actor-substack-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 = {
    "targetUrls": ["https://thealgorithmicbridge.substack.com"],
    "searchKeywords": ["artificial intelligence agents"],
}

# Run the Actor and wait for it to finish
run = client.actor("khnaami/actor-substack-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 '{
  "targetUrls": [
    "https://thealgorithmicbridge.substack.com"
  ],
  "searchKeywords": [
    "artificial intelligence agents"
  ]
}' |
apify call khnaami/actor-substack-scraper --silent --output-dataset

```

## MCP server setup

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