Skip to content
Back to search

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.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zarazhangrui--youtube-to-ebook/badge.svg)](/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

i

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)

  1. ---
  2. name: youtube-to-ebook
  3. description: Transform YouTube videos into beautifully formatted ebook articles with transcripts
  4. ---
  5. # YouTube to Ebook
  6. Transform YouTube videos from your favorite channels into well-written magazine-style articles, delivered as an EPUB ebook.
  7. ## What This Skill Does
  8. 1. Fetches latest videos from YouTube channels (filtering out Shorts)
  9. 2. Extracts transcripts from those videos
  10. 3. Transforms transcripts into polished articles using Claude
  11. 4. Packages articles into an EPUB ebook for reading on any device
  12. ## Quick Start
  13. Ask: "Set up YouTube to ebook for me"
  14. I'll guide you through:
  15. 1. Creating a project folder
  16. 2. Setting up YouTube API access
  17. 3. Configuring your favorite channels
  18. 4. Generating your first ebook
  19. ## Requirements
  20. - Python 3.8+
  21. - YouTube Data API key (free from Google Cloud Console)
  22. - Anthropic API key (for Claude)
  23. ## Commands
  24. | Command | Description |
  25. |---------|-------------|
  26. | `python main.py` | Generate ebook from latest videos |
  27. | `python main.py --channels` | Edit channel list |
  28. | `python dashboard.py` | Launch web dashboard |
  29. ## Key Files
  30. ```
  31. youtube-newsletter/
  32. ├── get_videos.py # Fetch latest videos
  33. ├── get_transcripts.py # Extract transcripts
  34. ├── write_articles.py # Transform to articles
  35. ├── send_email.py # Create EPUB & send
  36. ├── main.py # Run full pipeline
  37. ├── channels.txt # Your channel list
  38. └── .env # API keys
  39. ```
  40. ## Known Pitfalls & Solutions
  41. ### 1. YouTube Shorts Detection
  42. **Problem**: Filtering by duration doesn't work—some Shorts are longer than 60 seconds.
  43. **Solution**: Check if the `/shorts/` URL resolves:
  44. ```python
  45. def is_youtube_short(video_id):
  46. shorts_url = f"https://www.youtube.com/shorts/{video_id}"
  47. response = requests.head(shorts_url, allow_redirects=True, timeout=5)
  48. return "/shorts/" in response.url
  49. ```
  50. ### 2. Videos Not in Chronological Order
  51. **Problem**: YouTube Search API doesn't return truly chronological results.
  52. **Solution**: Use the channel's uploads playlist via `playlistItems` API:
  53. ```python
  54. # Get uploads playlist ID from channel
  55. channel_info = youtube.channels().list(
  56. part="contentDetails",
  57. forHandle=handle
  58. ).execute()
  59. uploads_playlist_id = channel_info["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"]
  60. # Fetch from uploads playlist (always chronological)
  61. youtube.playlistItems().list(
  62. part="snippet",
  63. playlistId=uploads_playlist_id,
  64. maxResults=15
  65. ).execute()
  66. ```
  67. ### 3. Transcript API Syntax
  68. **Problem**: `YouTubeTranscriptApi.get_transcript()` no longer works.
  69. **Solution**: Use instance method:
  70. ```python
  71. from youtube_transcript_api import YouTubeTranscriptApi
  72. ytt_api = YouTubeTranscriptApi()
  73. transcript = ytt_api.fetch(video_id)
  74. ```
  75. ### 4. Rate Limiting on Transcripts
  76. **Problem**: Fetching many transcripts quickly triggers rate limits.
  77. **Solution**: Add 2-second delays between requests:
  78. ```python
  79. import time
  80. for video in videos:
  81. transcript = get_transcript(video["video_id"])
  82. time.sleep(2)
  83. ```
  84. ### 5. Transcript Accuracy (Names, Terms)
  85. **Problem**: Auto-transcripts misspell names and technical terms.
  86. **Solution**: Include video title and description in Claude's context—these usually have correct spellings.
  87. ### 6. Cloud Automation Blocked
  88. **Problem**: GitHub Actions and cloud servers are blocked by YouTube for transcript fetching.
  89. **Solution**: Run automation locally on your Mac using `launchd`:
  90. ```xml
  91. <!-- ~/Library/LaunchAgents/com.youtube.ebook.plist -->
  92. <plist version="1.0">
  93. <dict>
  94. <key>Label</key>
  95. <string>com.youtube.ebook</string>
  96. <key>ProgramArguments</key>
  97. <array>
  98. <string>/usr/bin/python3</string>
  99. <string>/path/to/main.py</string>
  100. </array>
  101. <key>StartCalendarInterval</key>
  102. <dict>
  103. <key>Weekday</key>
  104. <integer>3</integer>
  105. <key>Hour</key>
  106. <integer>7</integer>
  107. </dict>
  108. </dict>
  109. </plist>
  110. ```
  111. ## Customization
  112. ### Writing Style
  113. Edit the prompt in `write_articles.py` to change article tone:
  114. - Magazine style (default)
  115. - Academic summary
  116. - Casual blog post
  117. - Technical documentation
  118. ### Email Delivery (Optional)
  119. Add Gmail credentials to `.env` to receive ebooks via email:
  120. ```
  121. GMAIL_ADDRESS=your@gmail.com
  122. GMAIL_APP_PASSWORD=your-app-password
  123. ```
  124. ## Workflow
  125. ```
  126. ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ ┌────────────┐
  127. │ Fetch Videos│───▶│Get Transcripts│───▶│Write Articles │───▶│Create EPUB │
  128. │ (YouTube API)│ │(Transcript API)│ │ (Claude AI) │ │ (ebooklib) │
  129. └─────────────┘ └──────────────┘ └───────────────┘ └────────────┘
  130. ```
  131. ## Example Output
  132. The generated EPUB contains:
  133. - Table of contents with all articles
  134. - Clean, readable formatting
  135. - Original video links for reference
  136. - 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)

  1. # YouTube to Ebook
  2. Transform YouTube videos from your favorite channels into beautifully formatted EPUB ebooks.
  3. ## Features
  4. - Fetches latest videos from YouTube channels (automatically filters out Shorts)
  5. - Extracts transcripts from videos
  6. - Uses Claude AI to transform transcripts into polished magazine-style articles
  7. - Generates EPUB ebooks readable on any device
  8. - Optional: Email delivery with ebook attachment
  9. - Optional: Web dashboard for easy management
  10. ## Quick Start
  11. 1. **Clone and install:**
  12. ```bash
  13. git clone https://github.com/YOUR_USERNAME/youtube-to-ebook.git
  14. cd youtube-to-ebook
  15. pip install -r requirements.txt
  16. ```
  17. 2. **Set up API keys:**
  18. ```bash
  19. cp .env.example .env
  20. # Edit .env with your keys
  21. ```
  22. 3. **Add your channels:**
  23. ```bash
  24. # Edit channels.txt with YouTube channel handles
  25. @mkbhd
  26. @veritasium
  27. @3blue1brown
  28. ```
  29. 4. **Generate your ebook:**
  30. ```bash
  31. python main.py
  32. ```
  33. ## Getting API Keys
  34. ### YouTube Data API (Free)
  35. 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
  36. 2. Create a new project
  37. 3. Enable "YouTube Data API v3"
  38. 4. Create credentials → API Key
  39. 5. Copy to `.env`
  40. ### Anthropic API
  41. 1. Go to [Anthropic Console](https://console.anthropic.com/)
  42. 2. Create an API key
  43. 3. Copy to `.env`
  44. ## Web Dashboard
  45. Launch a friendly web interface:
  46. ```bash
  47. pip install streamlit
  48. python -m streamlit run dashboard.py
  49. ```
  50. ## Automation (Mac)
  51. Run automatically every week:
  52. ```bash
  53. # Copy the plist to LaunchAgents
  54. cp com.youtube.newsletter.plist ~/Library/LaunchAgents/
  55. # Load it
  56. launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.youtube.newsletter.plist
  57. ```
  58. ## Troubleshooting
  59. ### "ModuleNotFoundError" when running automation
  60. Your Mac may have multiple Python installations. The automation scripts use `python3`, but your packages might be installed in a different Python.
  61. **Fix:** Find your Python path and update the scripts:
  62. ```bash
  63. # Find where your Python is
  64. which python3
  65. # Update run_newsletter.sh and dashboard.py with the full path
  66. # Example: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
  67. ```
  68. ## Known Issues & Solutions
  69. This project documents several YouTube API quirks:
  70. | Problem | Solution |
  71. |---------|----------|
  72. | Shorts not filtered by duration | Check `/shorts/` URL pattern |
  73. | Search API not chronological | Use uploads playlist instead |
  74. | Transcript API syntax changed | Use instance method `ytt_api.fetch()` |
  75. | Cloud servers blocked | Run locally, not GitHub Actions |
  76. | Names misspelled in transcripts | Include video description in Claude context |
  77. | Articles truncated mid-sentence | Increase `max_tokens` in write_articles.py |
  78. See [SKILL.md](SKILL.md) for detailed explanations.
  79. ## Project Structure
  80. ```
  81. ├── main.py # Run the full pipeline
  82. ├── get_videos.py # Fetch videos from YouTube
  83. ├── get_transcripts.py # Extract video transcripts
  84. ├── write_articles.py # Transform to articles with Claude
  85. ├── send_email.py # Create EPUB & send email
  86. ├── dashboard.py # Streamlit web dashboard
  87. ├── video_tracker.py # Track processed videos
  88. ├── channels.txt # Your channel list
  89. ├── .env # Your API keys (not committed)
  90. └── newsletters/ # Archive of generated ebooks
  91. ```
  92. ## License
  93. MIT - Use freely, modify as needed.
  94. ---
  95. Built with Claude AI

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.