# Substack Scraper & Newsletter Finder (`marc0scabrera/substack-scraper`) Actor

Extract newsletters, publications, authors, subscriber counts, and social links from Substack. Fast, lightweight, and export-ready for Excel/CSV.

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

## Pricing

$5.00 / 1,000 publication results

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

A high-performance, lightweight Apify Actor to discover, search, and extract rich publication, author, and subscriber intelligence from **[Substack](https://substack.com)**.

Built with Python and asynchronous HTTP clients without heavy headless browsers (like Selenium or Playwright), this actor runs seamlessly on **256–512 MB of memory**, completing extractions in seconds with maximum cost efficiency.

***

### 🌟 Why Use Substack Scraper?

Substack has become the epicenter of independent media, thought leadership, and niche professional audiences. Whether you are seeking newsletter sponsorships, running creator outreach, or conducting media research, this Actor provides structured, export-ready data directly to **CSV, Excel, or JSON**.

#### 🎯 Key Use Cases

1. **Newsletter Sponsorships & Media Buying**
   - Identify top publications within your niche using targeted keyword and category searches.
   - Gauge audience size with subscriber badges (`Over 100,000 subscribers`, `Bestseller badge`).
   - Find direct contact channels and creator social profiles for partnership pitches.

2. **B2B Creator & Influencer Outreach**
   - Prospect top domain experts, founders, engineers, and analysts in AI, SaaS, Finance, Crypto, and more.
   - Extract author biographies, handles, and external social media links (LinkedIn, X/Twitter, YouTube).
   - Build targeted outreach lists for podcasts, advisor roles, or enterprise sales.

3. **Competitive Intelligence & Media Monitoring**
   - Track active publications covering emerging topics (e.g., *Technology*, *AI*, *Climate*, *Finance*).
   - Analyze publication positioning, hero copy, and author authority across verticals.
   - Monitor publication growth and category dominance through public category leaderboards.

***

### 🚀 Features

- **⚡ Blazing Fast & Ultra-Lightweight**: Uses direct API discovery, public category leaderboards, and embedded JSON preloads. No headless browser required—consumes only 256–512 MB of RAM.
- **🛡️ Server-Proof & Cloud-Resilient**: Automatically falls back to public category endpoints (`/api/v1/category/public/...`) when cloud IP blocks occur on standard search endpoints.
- **🔗 Direct Publication URLs**: Scrape exact Substack publications (custom domains or standard `.substack.com` URLs).
- **📊 Flat Schema for Excel & CSV**: Every record is returned as a 1D clean object, preventing nested JSON issues during spreadsheet export.
- **🏷️ Bestseller & Subscriber Badging**: Instantly filter which creators have earned Substack Bestseller status.
- **🔍 Transparent Cloud Logging**: HTTP status codes and response snippets are clearly reported if a request is challenged or throttled.

***

### 📥 Input Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `publicationUrls` | `array` | No | *(Top 5 tech publications)* | Direct publication URLs (e.g., `https://www.lennysnewsletter.com`, `https://newsletter.pragmaticengineer.com`). |
| `searchQueries` | `array` | No | `["technology", "artificial intelligence"]` | Keywords, topics, or categories to search for across Substack discovery. |
| `maxItems` | `integer` | No | `20` | Maximum total publications to collect (`0` for unlimited). |

#### Example Input

```json
{
  "publicationUrls": [
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com",
    "https://blog.bytebytego.com"
  ],
  "searchQueries": [
    "technology",
    "artificial intelligence"
  ],
  "maxItems": 25
}
```

***

### 📤 Output Data Format

Each publication is pushed as a structured, flat object:

```json
{
  "publicationId": 10845,
  "name": "Lenny's Newsletter",
  "subdomain": "lenny",
  "url": "https://www.lennysnewsletter.com",
  "category": "Newsletter",
  "description": "Deeply researched product, growth, and career advice for product leaders, founders, and ambitious builders.",
  "authorName": "Lenny Rachitsky",
  "authorHandle": "lenny",
  "authorBio": "Writing • Angel investing • Advising",
  "subscriberCountText": "Over 1,200,000 subscribers",
  "bestsellerBadge": true,
  "socialLinks": "https://x.com/lennysan",
  "scrapedAt": "2026-11-18T14:35:10.123456+00:00"
}
```

#### Field Reference

| Field | Type | Description |
|---|---|---|
| `publicationId` | `integer / string` | Unique Substack publication identifier. |
| `name` | `string` | Display name of the newsletter/publication. |
| `subdomain` | `string` | Substack subdomain identifier. |
| `url` | `string` | Canonical website or custom domain URL. |
| `category` | `string` | Categorization (e.g., Technology, Culture, Newsletter). |
| `description` | `string` | Tagline, hero bio, or meta description of the publication. |
| `authorName` | `string` | Primary creator or publication founder name. |
| `authorHandle` | `string` | Substack handle/username of the author. |
| `authorBio` | `string` | Biography of the author. |
| `subscriberCountText` | `string` | Visible subscriber tier (e.g., `Over 10,000 subscribers`, `1.2M+`). |
| `bestsellerBadge` | `boolean` | `true` if the publication holds an official Substack Bestseller badge. |
| `socialLinks` | `string` | Comma-separated external social links (X/Twitter, LinkedIn, YouTube, etc.). |
| `scrapedAt` | `string` | ISO 8601 UTC timestamp of when data was extracted. |

***

### 💻 Integration Examples

#### Python (via `apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run_input = {
    "publicationUrls": ["https://www.lennysnewsletter.com"],
    "searchQueries": ["technology"],
    "maxItems": 30,
}

run = client.actor("your-username/substack-scraper").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{item['name']} | {item['authorName']} | {item['subscriberCountText']}")
```

***

### ⚙️ Memory & Compute Settings

- **Recommended Memory**: `256 MB` to `512 MB`.
- **Run Duration**: Typically 5–15 seconds.
- **Compute Units**: Minimal cost per run compared to browser-based crawlers.

# Actor input Schema

## `publicationUrls` (type: `array`):

Direct Substack publication URLs or custom domains. Recommended for reliable extraction in cloud environments without proxy blocks.

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

Keywords, topics, or categories (e.g. 'technology', 'artificial intelligence', 'business', 'finance') to discover publications across Substack.

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

Maximum number of publications to return. Set to 0 for unlimited results.

## Actor input object example

```json
{
  "publicationUrls": [
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com",
    "https://garymarcus.substack.com",
    "https://magazine.sebastianraschka.com",
    "https://blog.bytebytego.com"
  ],
  "searchQueries": [
    "technology",
    "artificial intelligence"
  ],
  "maxItems": 20
}
```

# Actor output Schema

## `results` (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 = {
    "publicationUrls": [
        "https://www.lennysnewsletter.com",
        "https://newsletter.pragmaticengineer.com",
        "https://garymarcus.substack.com",
        "https://magazine.sebastianraschka.com",
        "https://blog.bytebytego.com"
    ],
    "searchQueries": [
        "technology",
        "artificial intelligence"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("marc0scabrera/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 = {
    "publicationUrls": [
        "https://www.lennysnewsletter.com",
        "https://newsletter.pragmaticengineer.com",
        "https://garymarcus.substack.com",
        "https://magazine.sebastianraschka.com",
        "https://blog.bytebytego.com",
    ],
    "searchQueries": [
        "technology",
        "artificial intelligence",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("marc0scabrera/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 '{
  "publicationUrls": [
    "https://www.lennysnewsletter.com",
    "https://newsletter.pragmaticengineer.com",
    "https://garymarcus.substack.com",
    "https://magazine.sebastianraschka.com",
    "https://blog.bytebytego.com"
  ],
  "searchQueries": [
    "technology",
    "artificial intelligence"
  ]
}' |
apify call marc0scabrera/substack-scraper --silent --output-dataset

```

## MCP server setup

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