A Python command-line tool that reads your Gmail newsletters, scrapes configured tech news pages, and generates a personalised AI digest as a Hugo-compatible Markdown article — filtered to your interests using Claude via LangChain.
python digest.py
→ content/digest/digest-2026-04-19.md ready for Hugo.
- Gmail — searches your inbox for configured newsletter senders (last N days)
- Web scraper — fetches configured URLs and extracts article text
- LangChain + Claude — scores and summarises stories against your interest profile
- Hugo renderer — writes a dated Markdown article with front matter, ready to drop into your Hugo content folder
git clone https://github.com/yourname/ai-digest-cli
cd ai-digest-clipython3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtYou need a credentials.json file from Google Cloud. Do this once:
- Go to console.cloud.google.com
- Create a new project (e.g.
ai-digest) - Go to APIs & Services → Library → search Gmail API → Enable
- Go to APIs & Services → OAuth consent screen (or Google Auth Platform)
- Click Get started → fill in app name + email → Audience: External
- Under Audience, add your newsletter Gmail address as a test user
- Go to APIs & Services → Credentials → Create Credentials → OAuth client ID
- Application type: Desktop app
- Download the JSON → rename it
credentials.json→ place in this folder
cp config.example.yaml config.yamlEdit config.yaml:
- Add your Anthropic API key (get one at console.anthropic.com)
- Add your newsletter sender addresses
- Add web sources to scrape
- Customise your interest categories
python digest.pyOn first run, a browser window opens for Gmail sign-in — sign in with your newsletter Gmail account. A token.json is saved locally. Every subsequent run is fully silent.
# Default (uses config.yaml, last 7 days)
python digest.py
# Override days
python digest.py --days 14
# Override output directory
python digest.py --output ~/Documents/digests/
# Skip Gmail (web only)
python digest.py --no-gmail
# Skip web scraping (Gmail only)
python digest.py --no-web
# Use a different config file
python digest.py --config myconfig.yamlai-digest-cli/
├── digest.py ← Entry point — run this
├── config.yaml ← Your config (gitignored)
├── config.example.yaml ← Template to copy
├── gmail_reader.py ← Gmail OAuth + thread fetching
├── web_scraper.py ← BeautifulSoup URL scraper
├── digest_chain.py ← LangChain + Claude pipeline
├── credentials.json ← Google OAuth credentials (gitignored)
├── token.json ← Saved Gmail session (gitignored)
├── requirements.txt
└── README.md
credentials.jsonandtoken.jsonare gitignored — never committedconfig.yaml(contains your API key) is gitignored- The app only requests
gmail.readonlyscope — it cannot send email or modify anything - Your Anthropic API key is only sent to
api.anthropic.com
- Python 3.10+
- Anthropic API key (console.anthropic.com)
- Google Cloud project with Gmail API enabled
MIT