Transform YouTube videos from your favorite channels into beautifully formatted EPUB ebooks.
- Fetches latest videos from YouTube channels (automatically filters out Shorts)
- Extracts transcripts from videos
- Uses Claude AI to transform transcripts into polished magazine-style articles
- Generates EPUB ebooks readable on any device
- Optional: Email delivery with ebook attachment
- Optional: Web dashboard for easy management
-
Clone and install:
git clone https://github.com/YOUR_USERNAME/youtube-to-ebook.git cd youtube-to-ebook pip install -r requirements.txt -
Set up API keys:
cp .env.example .env # Edit .env with your keys -
Add your channels:
# Edit channels.txt with YouTube channel handles @mkbhd @veritasium @3blue1brown -
Generate your ebook:
python main.py
- Go to Google Cloud Console
- Create a new project
- Enable "YouTube Data API v3"
- Create credentials → API Key
- Copy to
.env
- Go to Anthropic Console
- Create an API key
- Copy to
.env
Launch a friendly web interface:
pip install streamlit
python -m streamlit run dashboard.pyRun automatically every week:
# Copy the plist to LaunchAgents
cp com.youtube.newsletter.plist ~/Library/LaunchAgents/
# Load it
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.youtube.newsletter.plistYour Mac may have multiple Python installations. The automation scripts use python3, but your packages might be installed in a different Python.
Fix: Find your Python path and update the scripts:
# Find where your Python is
which python3
# Update run_newsletter.sh and dashboard.py with the full path
# Example: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3This project documents several YouTube API quirks:
| Problem | Solution |
|---|---|
| Shorts not filtered by duration | Check /shorts/ URL pattern |
| Search API not chronological | Use uploads playlist instead |
| Transcript API syntax changed | Use instance method ytt_api.fetch() |
| Cloud servers blocked | Run locally, not GitHub Actions |
| Names misspelled in transcripts | Include video description in Claude context |
| Articles truncated mid-sentence | Increase max_tokens in write_articles.py |
See SKILL.md for detailed explanations.
├── main.py # Run the full pipeline
├── get_videos.py # Fetch videos from YouTube
├── get_transcripts.py # Extract video transcripts
├── write_articles.py # Transform to articles with Claude
├── send_email.py # Create EPUB & send email
├── dashboard.py # Streamlit web dashboard
├── video_tracker.py # Track processed videos
├── channels.txt # Your channel list
├── .env # Your API keys (not committed)
└── newsletters/ # Archive of generated ebooks
MIT - Use freely, modify as needed.
Built with Claude AI