An end-to-end automation that runs every morning at 7 AM, scrapes the latest AI news, writes a full newsletter post using Claude, and publishes a draft to Substack that completely on its own.
Built by Drona Gangarapu Built using Claude Cowork by Anthropic
- Scrapes real-time AI news from Google News RSS (no API cost)
- Sends the news to Anthropic's Claude API to write a structured newsletter post
- Fetches a relevant cover image from Pexels and saves it locally
- Opens a real browser using Playwright, logs into Substack via session cookies
- Types the full post into the Substack editor
- Inserts Subscribe and Share Post CTA buttons
- Saves the draft ready for one-click publish
- Runs automatically every day at 7 AM via macOS launchd
| Tool | Purpose |
|---|---|
| Python | Core automation logic |
| Anthropic Claude API | AI-powered post writing |
| Playwright | Browser automation |
| Google News RSS | Free real-time news scraping |
| Pexels API | Royalty-free cover images |
| macOS launchd | Daily 7 AM scheduling |
pip install anthropic requests python-dotenv playwright
playwright install chromiumcp .env.template .envThen fill in your credentials:
ANTHROPIC_API_KEY=your_key_here
SUBSTACK_COOKIE=your_full_cookie_string_here
PEXELS_API_KEY=your_key_here
How to get your Substack cookie:
- Log into your Substack in Chrome
- Open DevTools → Application → Cookies → substack.com
- Copy the full cookie string from your request headers
python3 ~/SubstackBot/daily_ai_post.pycp com.drona.daily-ai-post.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.drona.daily-ai-post.plistcat /tmp/daily_ai_post.log
cat /tmp/daily_ai_post_err.logSubstackBot/
├── daily_ai_post.py # Main automation script
├── com.drona.daily-ai-post.plist # macOS launchd schedule config
├── .env.template # Credentials template (copy to .env)
├── .gitignore
├── README.md
├── images/ # Cover images saved here (gitignored)
└── posts/ # Local post backups (gitignored)
Each generated post includes:
- Bold title + subtitle at the top
- Intro hook
- 3–4 top AI stories with "How YOU can use this today" breakdowns for Students, Professionals, and Everyday People
- New AI Tool Spotlight
- Key Takeaways
- References with exact source URLs (no hallucinations, every story is grounded in the RSS feed)
- Subscribe + Share Post buttons
- Disclaimer
- Your Mac must be on and connected to the internet at 6 AM for the schedule to trigger
- If the Mac is asleep, launchd will run the job when it next wakes up
- The
.envfile is gitignored — never commit your API keys
This project uses two licenses:
Code — MIT License
The source code (daily_ai_post.py, run_bot.sh, config files) is licensed under the MIT License. You are free to use, modify, and distribute the code with attribution.
Content — Creative Commons CC BY 4.0 The newsletter posts and written content generated by this bot are licensed under Creative Commons Attribution 4.0 International. You may share and adapt the content with proper credit to Drona Gangarapu.