# Substack Newsletter Scraper (`gstech/substack-posts`) Actor

Export Substack newsletter posts by URL or keyword search. Optional comments, full HTML, and publication info.

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

## Pricing

$1.00 / 1,000 result rows

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?

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

Export posts from Substack newsletters into an Apify dataset. Optional comments, full post HTML, and one publication row per newsletter.

This is a job wrapper around [GloStream Substack Live](https://www.glostreamtech.com/substack-api) — the same unofficial live API listed on RapidAPI. Paste newsletter URLs and/or search queries, get rows.

### Input

| Field | What it does |
| --- | --- |
| `publications` | URLs, custom domains, or Substack subdomains |
| `searchQueries` | Keywords to find newsletters (directory search), then export those pubs |
| `maxPublications` | Cap on newsletters discovered from search (default 20) |
| `language` | Optional ISO code for directory search |
| `maxPosts` | Matching posts to keep per publication (default 50) |
| `sort` | `new` or `top` |
| `includePublicationInfo` | One `publication` row (default on) |
| `includePostBody` | Fetch full HTML for each post |
| `includeComments` | One row per comment, replies flattened |
| `maxCommentsPerPost` | Cap comments per post (`0` = all) |
| `startDate` / `endDate` | Keep posts in this UTC day range |
| `onlyFree` | Skip paid and founding posts |
| `postType` | `all`, `newsletter`, `podcast`, or `thread` |

Examples of `publications`:

- `https://platformer.substack.com`
- `platformer`
- `lenny.substack.com`

### Output

Each dataset item is a `publication`, `post`, or `comment`.

Posts include title, URL, date, authors, tags, comment/reaction counts, type, paywall flag, and (if requested) body HTML. Publication rows include name, author, logo, and public subscriber count when Substack exposes it.

### Notes

- Public archive only. Paywalled body text follows what Substack exposes without a session.
- Not affiliated with Substack.
- Live REST access (search, feeds, one-off reads) stays on [RapidAPI](https://rapidapi.com/glostream-tech-glostream-tech-default/api/substack-live). Support: [Discord](https://discord.gg/68VXD8BP).

# Actor input Schema

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

Newsletter URLs, custom domains, or Substack subdomains. Optional if you set search queries.

Supports:

- `https://platformer.substack.com`
- `platformer`
- `lenny.substack.com`

## `searchQueries` (type: `array`):

Find newsletters by name or topic via Substack directory search, then export their posts. Combined with any URLs you pasted.

## `maxPublications` (type: `integer`):

How many newsletters to keep from search queries. Pasted URLs are always included.

## `language` (type: `string`):

ISO code passed to directory search, e.g. `en` or `es`. Leave empty for default ranking.

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

How many matching posts to keep from each publication after filters.

## `sort` (type: `string`):

Archive sort order.

## `includePublicationInfo` (type: `boolean`):

One dataset row per newsletter (name, author, logo, subscriber count when public).

## `includePostBody` (type: `boolean`):

Fetch HTML for each post. Slower. Archive metadata and preview text are always included.

## `includeComments` (type: `boolean`):

Add one dataset row per comment. Nested replies are flattened.

## `maxCommentsPerPost` (type: `integer`):

Cap flattened comment rows per post. `0` means all comments. Used only when Include comments is on.

## `startDate` (type: `string`):

Keep posts on or after this day (UTC).

## `endDate` (type: `string`):

Keep posts on or before this day (UTC).

## `onlyFree` (type: `boolean`):

Skip subscriber-only and founding-member posts.

## `postType` (type: `string`):

Limit to newsletters, podcasts, or threads.

## Actor input object example

```json
{
  "publications": [
    "https://platformer.substack.com"
  ],
  "maxPublications": 20,
  "maxPosts": 50,
  "sort": "new",
  "includePublicationInfo": true,
  "includePostBody": false,
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "onlyFree": false,
  "postType": "all"
}
```

# Actor output Schema

## `dataset` (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://platformer.substack.com"
    ],
    "maxPublications": 20,
    "maxPosts": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("gstech/substack-posts").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://platformer.substack.com"],
    "maxPublications": 20,
    "maxPosts": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("gstech/substack-posts").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://platformer.substack.com"
  ],
  "maxPublications": 20,
  "maxPosts": 50
}' |
apify call gstech/substack-posts --silent --output-dataset

```

## MCP server setup

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

```

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/Aq7uJgvARy97JHmXs/builds/fXtMasatnExceBLBk/openapi.json
