Every Substack newsletter has a few posts that got far more likes, comments and restacks than the rest. Those posts tell you what its readers actually want. In this tutorial you will pull every post of any newsletter into Python and rank them, in about 15 lines of code.
You will get, for each post:
- Title, subtitle, date and authors
- Likes, comments, restacks and word count
- Whether it is free or paid
- The full text of free posts (great for research or LLM datasets)
Full disclosure: I built the scraper used here. It reads Substack's public data, so you don't need a login or an API key from Substack.
Setup (2 minutes)
- Create a free account at apify.com. The free plan includes monthly credits, enough to follow this tutorial.
- Copy your API token from Settings → API & Integrations in the Apify Console.
- Install the client and save the token as an environment variable:
pip install "apify-client>=3" export APIFY_TOKEN="your_token_here" Get the top posts of a newsletter
This gets the 20 most popular posts of Lenny's Newsletter. It works with name.substack.com addresses and with custom domains.
import os from apify_client import ApifyClient client = ApifyClient(os.environ["APIFY_TOKEN"]) run = client.actor("neronbaez/substack-scraper").call(run_input={ "publications": ["lennysnewsletter.com"], "sort": "top", # "top" = most popular, "new" = latest "maxPostsPerPublication": 20, "includeContent": True, # full text of free posts }) posts = list(client.dataset(run.default_dataset_id).iterate_items()) for p in posts: print(f'{p["likes"]:>5} likes | {p["comments"]:>3} comments | ' f'{p["wordCount"]:>5} words | {p["title"]}') Each post comes back as a JSON object like this one (trimmed):
{ "title": "How to tell if a startup has a moat", "url": "https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat", "postDate": "2026-10-13T12:45:41.160Z", "isPaid": true, "likes": 311, "comments": 2, "restacks": 11, "wordCount": 4153, "authors": [{"name": "Dan Hockenmaier", "handle": "danhock"}] } Find what works: free vs paid, short vs long
With the posts in a list, two quick questions are one line each:
from statistics import mean free = [p["likes"] for p in posts if not p["isPaid"]] paid = [p["likes"] for p in posts if p["isPaid"]] print("avg likes free:", round(mean(free)) if free else "-") print("avg likes paid:", round(mean(paid)) if paid else "-") long_posts = [p["likes"] for p in posts if p["wordCount"] > 2500] short_posts = [p["likes"] for p in posts if p["wordCount"] <= 2500] print("avg likes long:", round(mean(long_posts)) if long_posts else "-") print("avg likes short:", round(mean(short_posts)) if short_posts else "-") Run it on two or three newsletters in your niche and you will quickly see which formats and topics get the most engagement.
Going further
Read the comments. Set "includeComments": True and each comment comes back as its own item with text, author, likes and date. That is the fastest way to learn what readers ask for.
Compare newsletters. Put several in "publications" (for example ["lennysnewsletter.com", "astralcodexten.com"]) and group the results by the publication field.
Build a dataset. With "sort": "new" and a higher maxPostsPerPublication, you get a clean archive of full-text posts for search or RAG. Only free posts include the full text; paid posts include a preview.
Cost. You pay per result: $0.002 per post and $0.0005 per comment, so the latest 100 posts of a newsletter cost $0.20.
Wrap-up
You now have any newsletter's posts as data, ranked by what readers liked. You can also run the Substack Scraper from the browser without code and export to CSV or Excel.
If you need a field or filter it doesn't have, open an issue on the Actor page and I'll add it. Which newsletter would you analyze first? Tell me in the comments.
