Substack Mention Tracker
Python tool to track how often specific terms appear in Substack articles over time
A Python script that tracks how often specific terms (e.g., “Claude Code”, “AI coding”) appear in Substack articles over time, grouped by month. Try it out instantly in the Google Colab notebook.
How It Works
The script uses Substack’s undocumented search API (discovered through reverse engineering) to fetch article metadata, extract publication dates, and aggregate mention counts by month. It produces:
- A formatted console table
- A CSV file with monthly counts
- A line chart visualization
- An optional detailed JSON export with full post metadata
API Details
The tool queries GET https://substack.com/api/v1/post/search, which requires no authentication and returns up to ~2,000 results per query (100 pages × 20 results). Each result includes the post title, publication date (ISO-8601), canonical URL, reaction count, comment count, word count, and author information.
Rate limiting is handled automatically with exponential backoff retry.
Usage
Basic usage (default queries: “Claude Code” and “AI coding”)
python3 substack_mention_tracker.py
Custom queries
python3 substack_mention_tracker.py --queries "Claude Code" "AI coding" "vibe coding" "Cursor AI"
Control pagination and output
python3 substack_mention_tracker.py \
--max-pages 50 \
--delay 2.0 \
--output results.csv \
--chart trend_chart.png \
--json detailed_results.json
Limitations
- Undocumented API — The endpoint is not part of Substack’s official API and could change at any time. Best suited for periodic research, not production monitoring.
- ~2,000 result cap per query — For very popular terms, older results may be truncated. Consider running monthly and accumulating data over time.
- Relevance-based search — The API performs relevance-based search, not strict substring matching. A search for “AI coding” may return articles that mention “AI” and “coding” separately.
Extending the Script
- Add more queries via
--queries - Schedule monthly runs with
cronand append to a cumulative CSV - Post-filter for exact phrase matches in titles or body text
- Analyze engagement metrics (reaction count, comment count, word count) from the detailed JSON output