Skip to content

Latest commit

 

History

History
132 lines (96 loc) · 4.31 KB

YOUTUBE.md

File metadata and controls

132 lines (96 loc) · 4.31 KB

📺 YouTube Pipeline

Navigation: ← Docs Index | Modules | CLI Reference

Turn YouTube playlists into structured course materials. The pipeline downloads transcripts, scaffolds them into per-playlist course structures, and renders them through the publishing engine. The current archive (course_development/youtube/) covers 38 playlists / ~821 videos per youtube_courses.json metadata.


🚀 Quick Start

cd software

# 1. Download transcripts (auto-caption or Whisper)
uv run python scripts/transcribe_youtube.py --video-id <ID>

# 2. Render playlists as courses
uv run python scripts/render_youtube_courses.py --course active-inference-textbook-group

# 3. Translate transcripts to another language
uv run python scripts/translate_youtube.py --lang ja

🛠️ Components

Script Purpose
transcribe_youtube.py Downloads audio/captions. Uses Whisper if needed.
render_youtube_courses.py Scaffolds course structure from transcripts.
translate_youtube.py Translates transcript archives to target languages.

📋 Workflow

graph LR
    A[YouTube Video] --> B[transcribe_youtube.py]
    B --> C[Raw Transcript .md]
    C --> D[render_youtube_courses.py]
    D --> E[Structured Course]
    E --> F[publish.py]
    F --> G[PDF / HTML / Audio]
Loading
  1. Transcription: Downloads auto-captions or runs Whisper for higher accuracy.
  2. Scaffolding: Creates one course directory per playlist, with a numbered video subdirectory per video; each contains a module.md built from the transcript.
  3. Publishing: The publish.py pipeline integrates this step automatically — see ORCHESTRATION.md.

🎧 Whisper Setup

For high-quality transcription (when auto-captions are bad or missing), install Whisper:

# Install extra dependencies
uv sync --extra whisper

# Transcribe with Whisper
uv run python scripts/transcribe_youtube.py --whisper-model base

# Available models: tiny, base, small, medium, large
# Larger models = better accuracy, slower speed

Tip: Start with base for a good speed/accuracy tradeoff. Use medium or large for noisy audio or non-English content.


📊 Manifest & Metadata

Playlist metadata is stored in course_development/youtube/youtube_courses.json (generated by enumerate_channel_playlists). This file:

  • Records every playlist (id, title, url, slug) and the videos in each (id, title, duration).
  • Is the source of truth for the archive's size (38 playlists, ~821 videos).
{
  "channel_url": "https://www.youtube.com/@ActiveInference",
  "last_updated": "2026-01-15T10:30:00Z",
  "total_playlists": 38,
  "playlists": {
    "active-inference-textbook-group": {
      "id": "PL...",
      "title": "Active Inference Textbook Group",
      "url": "https://www.youtube.com/playlist?list=PL...",
      "slug": "active-inference-textbook-group",
      "video_count": 30,
      "videos": [{"id": "ogV63M3uTlQ", "title": "ActInf Textbook Group ~ Cohort 1 ~ Meeting 1"}]
    }
  }
}

Transcription tracking: transcribe_youtube.py writes per-run state to a manifest.json in its output directory (default software/transcription/), recording which video IDs have already been processed so re-runs can resume. That manifest is separate from the playlist metadata above.


📂 Output Structure

Scaffolded archive under course_development/youtube/:

course_development/youtube/
├── youtube_courses.json          # playlist + video metadata
├── active-inference-textbook-group/
│   ├── 01_actinf-textbook-group-cohort-1-meeting-1-onboarding/
│   │   ├── module.md             # transcript with source front-matter
│   │   ├── dashboard.html
│   │   └── output/               # rendered formats
│   ├── 02_actinf-textbook-group-cohort-1-meeting-2-chapter-1/
│   │   └── module.md
│   └── ...
└── ...                           # 38 playlist directories total

⚠️ Known Limitations

  • Auto-captions may have poor accuracy for technical terminology.
  • Rate limiting: YouTube may throttle transcript downloads. Space out batch requests.
  • Whisper memory: The large model requires ~10 GB VRAM.

Last Updated: 2026-08-02