youtube-to-ebook
Claude skill for turning YouTube transcripts from your favorite channels into EPUB ebooks, delivered to your email inbox regularly
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/zarazhangrui--youtube-to-ebook)HTML
<a href="/listings/zarazhangrui--youtube-to-ebook"><img src="/api/listings/zarazhangrui--youtube-to-ebook/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
1. **Clone and install:**
git clone https://github.com/YOUR_USERNAME/youtube-to-ebook.git cd youtube-to-ebook pip install -r requirements.txt
2. **Set up API keys:**
cp .env.example .env # Edit .env with your keys
3. **Add your channels:**
# Edit channels.txt with YouTube channel handles @mkbhd @veritasium @3blue1brown
4. **Generate your ebook:**
python main.py
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 171 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ---
- name: youtube-to-ebook
- description: Transform YouTube videos into beautifully formatted ebook articles with transcripts
- ---
- # YouTube to Ebook
- Transform YouTube videos from your favorite channels into well-written magazine-style articles, delivered as an EPUB ebook.
- ## What This Skill Does
- 1. Fetches latest videos from YouTube channels (filtering out Shorts)
- 2. Extracts transcripts from those videos
- 3. Transforms transcripts into polished articles using Claude
- 4. Packages articles into an EPUB ebook for reading on any device
- ## Quick Start
- Ask: "Set up YouTube to ebook for me"
- I'll guide you through:
- 1. Creating a project folder
- 2. Setting up YouTube API access
- 3. Configuring your favorite channels
- 4. Generating your first ebook
- ## Requirements
- - Python 3.8+
- - YouTube Data API key (free from Google Cloud Console)
- - Anthropic API key (for Claude)
- ## Commands
- | Command | Description |
- |---------|-------------|
- | `python main.py` | Generate ebook from latest videos |
- | `python main.py --channels` | Edit channel list |
- | `python dashboard.py` | Launch web dashboard |
- ## Key Files
- ```
- youtube-newsletter/
- ├── get_videos.py # Fetch latest videos
- ├── get_transcripts.py # Extract transcripts
- ├── write_articles.py # Transform to articles
- ├── send_email.py # Create EPUB & send
- ├── main.py # Run full pipeline
- ├── channels.txt # Your channel list
- └── .env # API keys
- ```
- ## Known Pitfalls & Solutions
- ### 1. YouTube Shorts Detection
- **Problem**: Filtering by duration doesn't work—some Shorts are longer than 60 seconds.
- **Solution**: Check if the `/shorts/` URL resolves:
- ```python
- def is_youtube_short(video_id):
- shorts_url = f"https://www.youtube.com/shorts/{video_id}"
- response = requests.head(shorts_url, allow_redirects=True, timeout=5)
- return "/shorts/" in response.url
- ```
- ### 2. Videos Not in Chronological Order
- **Problem**: YouTube Search API doesn't return truly chronological results.
- **Solution**: Use the channel's uploads playlist via `playlistItems` API:
- ```python
- # Get uploads playlist ID from channel
- channel_info = youtube.channels().list(
- part="contentDetails",
- forHandle=handle
- ).execute()
- uploads_playlist_id = channel_info["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"]
- # Fetch from uploads playlist (always chronological)
- youtube.playlistItems().list(
- part="snippet",
- playlistId=uploads_playlist_id,
- maxResults=15
- ).execute()
- ```
- ### 3. Transcript API Syntax
- **Problem**: `YouTubeTranscriptApi.get_transcript()` no longer works.
- **Solution**: Use instance method:
- ```python
- from youtube_transcript_api import YouTubeTranscriptApi
- ytt_api = YouTubeTranscriptApi()
- transcript = ytt_api.fetch(video_id)
- ```
- ### 4. Rate Limiting on Transcripts
- **Problem**: Fetching many transcripts quickly triggers rate limits.
- **Solution**: Add 2-second delays between requests:
- ```python
- import time
- for video in videos:
- transcript = get_transcript(video["video_id"])
- time.sleep(2)
- ```
- ### 5. Transcript Accuracy (Names, Terms)
- **Problem**: Auto-transcripts misspell names and technical terms.
- **Solution**: Include video title and description in Claude's context—these usually have correct spellings.
- ### 6. Cloud Automation Blocked
- **Problem**: GitHub Actions and cloud servers are blocked by YouTube for transcript fetching.
- **Solution**: Run automation locally on your Mac using `launchd`:
- ```xml
- <!-- ~/Library/LaunchAgents/com.youtube.ebook.plist -->
- <plist version="1.0">
- <dict>
- <key>Label</key>
- <string>com.youtube.ebook</string>
- <key>ProgramArguments</key>
- <array>
- <string>/usr/bin/python3</string>
- <string>/path/to/main.py</string>
- </array>
- <key>StartCalendarInterval</key>
- <dict>
- <key>Weekday</key>
- <integer>3</integer>
- <key>Hour</key>
- <integer>7</integer>
- </dict>
- </dict>
- </plist>
- ```
- ## Customization
- ### Writing Style
- Edit the prompt in `write_articles.py` to change article tone:
- - Magazine style (default)
- - Academic summary
- - Casual blog post
- - Technical documentation
- ### Email Delivery (Optional)
- Add Gmail credentials to `.env` to receive ebooks via email:
- ```
- GMAIL_ADDRESS=your@gmail.com
- GMAIL_APP_PASSWORD=your-app-password
- ```
- ## Workflow
- ```
- ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ ┌────────────┐
- │ Fetch Videos│───▶│Get Transcripts│───▶│Write Articles │───▶│Create EPUB │
- │ (YouTube API)│ │(Transcript API)│ │ (Claude AI) │ │ (ebooklib) │
- └─────────────┘ └──────────────┘ └───────────────┘ └────────────┘
- ```
- ## Example Output
- The generated EPUB contains:
- - Table of contents with all articles
- - Clean, readable formatting
- - Original video links for reference
- - Mobile-friendly styling
README.md · README · 126 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- # YouTube to Ebook
- Transform YouTube videos from your favorite channels into beautifully formatted EPUB ebooks.
- ## Features
- - 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
- ## Quick Start
- 1. **Clone and install:**
- ```bash
- git clone https://github.com/YOUR_USERNAME/youtube-to-ebook.git
- cd youtube-to-ebook
- pip install -r requirements.txt
- ```
- 2. **Set up API keys:**
- ```bash
- cp .env.example .env
- # Edit .env with your keys
- ```
- 3. **Add your channels:**
- ```bash
- # Edit channels.txt with YouTube channel handles
- @mkbhd
- @veritasium
- @3blue1brown
- ```
- 4. **Generate your ebook:**
- ```bash
- python main.py
- ```
- ## Getting API Keys
- ### YouTube Data API (Free)
- 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
- 2. Create a new project
- 3. Enable "YouTube Data API v3"
- 4. Create credentials → API Key
- 5. Copy to `.env`
- ### Anthropic API
- 1. Go to [Anthropic Console](https://console.anthropic.com/)
- 2. Create an API key
- 3. Copy to `.env`
- ## Web Dashboard
- Launch a friendly web interface:
- ```bash
- pip install streamlit
- python -m streamlit run dashboard.py
- ```
- ## Automation (Mac)
- Run automatically every week:
- ```bash
- # Copy the plist to LaunchAgents
- cp com.youtube.newsletter.plist ~/Library/LaunchAgents/
- # Load it
- launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.youtube.newsletter.plist
- ```
- ## Troubleshooting
- ### "ModuleNotFoundError" when running automation
- Your 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:
- ```bash
- # 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/python3
- ```
- ## Known Issues & Solutions
- This 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](SKILL.md) for detailed explanations.
- ## Project Structure
- ```
- ├── 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
- ```
- ## License
- MIT - Use freely, modify as needed.
- ---
- Built with Claude AI
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.