# Substack Newsletter, Posts & Author Leads Scraper (`velodata-labs/substack-newsletter-scraper`) Actor

Fast Substack newsletter, post archive, and author B2B lead scraper in Golang. Extract articles, engagement metrics (likes, comments, restacks, word count), subscriber counts, and verified author social links (LinkedIn, X/Twitter, YouTube, Website). MCP-ready for Clay and n8n.

- **URL**: https://apify.com/velodata-labs/substack-newsletter-scraper.md
- **Developed by:** [VeloData Labs](https://apify.com/velodata-labs) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 newsletter post & author leads

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, Posts & Author Leads Scraper

Extract newsletter articles, engagement metrics (`reactionCount`, `commentCount`, `restackCount`, `wordCount`), verified publication subscriber counts, and **author B2B social profiles** (`LinkedIn`, `X/Twitter`, `YouTube`, `Website`) from any Substack publication or creator handle.

Built in **Golang** (`128 MB` RAM) for instant execution and full **Model Context Protocol (MCP)** compatibility with **Clay**, **n8n**, **Make**, **Zapier**, and AI research agents.

***

### Key Capabilities

- **Substack Post & Archive Extraction**: Scrape latest (`new`) or top-performing (`top`) newsletter articles from any `.substack.com` subdomain, custom domain (e.g. `www.lennysnewsletter.com`, `newsletter.pragmaticengineer.com`), or `@handle`.
- **Verified Author B2B Lead Enrichment**: Automatically queries the author's Substack public profile to extract **subscriber counts** (e.g. `1,200,000` / `1.2M+ subscribers`), **bestseller tier**, and clickable **LinkedIn**, **X/Twitter**, **YouTube**, and **Website** links.
- **Engagement & Sponsorship Intelligence**: Analyze `reactionCount`, `commentCount`, `restackCount`, `wordCount`, and `audience` (`everyone` vs `only_paid`) to qualify newsletters for B2B sponsorships, PR outreach, or content research.

***

### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `targets` | `array` | `["pragmaticengineer", "lenny", "bytebytego"]` | Substack subdomains, custom domain URLs, or `@handles`. |
| `sort` | `string` | `"new"` | Sort posts by `"new"` (latest) or `"top"` (most popular). |
| `keyword` | `string` | `""` | Optional keyword filter applied to title, subtitle, tags, or author. |
| `audienceFilter` | `string` | `"all"` | Filter by `"all"`, `"everyone"` (free posts), or `"only_paid"`. |
| `includeBodyText` | `boolean` | `false` | Fetch full plain-text article body for each post. |
| `maxItems` | `integer` | `30` | Maximum number of posts to extract across all targets. |

***

### Sample Output JSON

```json
{
  "postId": 222810010,
  "title": "The Pulse: Anthropic kills the coding interview",
  "subtitle": "AI is rendering the Leetcode-style interview pointless and now Anthropic has deleted it from its interview loop.",
  "slug": "the-pulse-anthropic-kills-the-coding",
  "postUrl": "https://newsletter.pragmaticengineer.com/p/the-pulse-anthropic-kills-the-coding",
  "publishedAt": "2026-10-30T16:37:51.401Z",
  "audience": "only_paid",
  "isFree": false,
  "wordCount": 4545,
  "reactionCount": 61,
  "commentCount": 4,
  "restackCount": 2,
  "tags": ["incident.io", "Microsoft", "Anthropic", "Industry trends"],
  "publicationId": 458709,
  "publicationName": "The Pragmatic Engineer",
  "publicationSubdomain": "pragmaticengineer",
  "publicationUrl": "https://newsletter.pragmaticengineer.com",
  "subscriberCount": 1100000,
  "subscriberCountText": "1.1M+ subscribers",
  "bestsellerTier": 10000,
  "authorName": "Gergely Orosz",
  "authorHandle": "pragmaticengineer",
  "authorLinkedIn": "https://www.linkedin.com/in/gergelyorosz/",
  "authorTwitter": "https://x.com/GergelyOrosz",
  "authorYouTube": "https://www.youtube.com/@pragmaticengineer",
  "authorWebsite": "https://www.pragmaticengineer.com/",
  "scrapedAt": "2026-11-03T06:58:00Z"
}
```

# Actor input Schema

## `targets` (type: `array`):

List of Substack newsletter subdomains, custom domains, full URLs, or author handles. Examples: 'pragmaticengineer', 'lenny', 'semianalysis', 'bytebytego', 'https://www.lennysnewsletter.com', or '@pragmaticengineer'.

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

Sort newsletter posts by 'new' (latest published) or 'top' (most popular by engagement).

## `keyword` (type: `string`):

Case-insensitive keyword filter matched against post title, subtitle, tags, or author name (e.g., 'ai', 'agent', 'pricing', 'architecture').

## `audienceFilter` (type: `string`):

Filter posts by audience access: 'all' (all posts), 'everyone' (free public posts only), or 'only_paid' (paid subscriber posts only).

## `includeBodyText` (type: `boolean`):

When enabled, fetches the individual post endpoint to include the clean plain-text article body.

## `maxItems` (type: `integer`):

Maximum number of newsletter posts to return across all targets.

## Actor input object example

```json
{
  "targets": [
    "pragmaticengineer",
    "lenny",
    "bytebytego"
  ],
  "sort": "new",
  "audienceFilter": "all",
  "includeBodyText": false,
  "maxItems": 30
}
```

# Actor output Schema

## `posts` (type: `string`):

JSON/CSV dataset of Substack newsletter articles including title, URL, publication stats, subscriber counts, reaction/comment/restack metrics, and author LinkedIn/X/YouTube/Website links.

# 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 = {
    "targets": [
        "pragmaticengineer",
        "lenny",
        "bytebytego"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("velodata-labs/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 = { "targets": [
        "pragmaticengineer",
        "lenny",
        "bytebytego",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("velodata-labs/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 '{
  "targets": [
    "pragmaticengineer",
    "lenny",
    "bytebytego"
  ]
}' |
apify call velodata-labs/substack-newsletter-scraper --silent --output-dataset

```

## MCP server setup

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