A local utility that uses Google Gemini to analyze YouTube videos and extract structured knowledge for building an AI Agent Skills library.
- You provide YouTube video or playlist URLs
- Gemini analyzes both spoken content and visual demonstrations
- Structured evidence files are generated locally
- You give these files to GPT for deeper review and skill creation
Important: Gemini's analysis produces candidate knowledge — evidence and observations, NOT canonical skill guidance. GPT/human review comes afterwards before anything becomes a permanent Agent Skill.
- Python 3.11+
- A Google Gemini API key (Get one here)
- yt-dlp (installed via requirements.txt)
# Clone or navigate to the project
cd ai-skill-video-extractor
# Create virtual environment
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (macOS/Linux)
# source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Copy environment template
copy .env.example .env # Windows
# cp .env.example .env # macOS/Linux
# Add your Gemini API key to .env
# Edit .env and set: GEMINI_API_KEY=your_key_herestreamlit run app.pyThe app opens at http://localhost:8501.
- Select input mode: Single Video, Multiple Videos, or Playlist
- Paste URL(s) into the input field
- Click "Discover Videos" to enumerate and inspect what was found
- Select/deselect individual videos as needed
- Click "Start Analysis" to run Gemini analysis
- Monitor progress — failures on individual videos won't kill the run
- Find results in the
exports/directory - Give the export folder (or
run-summary.md+ video folders) to GPT for review
| Method | Priority | How |
|---|---|---|
| Session input | 1 (highest) | Enter in sidebar password field |
| Environment | 2 | Set GEMINI_API_KEY in .env |
The API key is never displayed, logged, or written to output files.
Default: gemini-3.6-flash
Configurable via:
.envfile:GEMINI_MODEL=gemini-3.6-flash- Sidebar text input in the UI
| Setting | Default | Description |
|---|---|---|
| Output Directory | ./exports |
Where run folders are created |
| Skip Processed | ✅ On | Don't re-analyze videos already done |
| Retry Failed | ❌ Off | Re-attempt previously failed videos |
| Max Videos | 50 | Limit per run |
exports/
2025-01-15_my-playlist/
README.md # Run description
manifest.json # All discovered videos + status
run-summary.md # Summary table for GPT review
errors.jsonl # Error log (if any)
videos/
001_great-design_dQw4w9/
source.json # Video metadata
analysis.json # Full structured Gemini analysis
REVIEW.md # Human/AI-readable review
002_debugging-tips_xYz1/
source.json
analysis.json
REVIEW.md
processed-index.json # Deduplication index
run-summary.md— Start here. Give this to GPT first. Contains a table of all videos, categories, priorities, and cross-video theme aggregation.analysis.json— Complete structured analysis (JSON). Machine-readable.REVIEW.md— Human-readable version of the analysis.source.json— Video metadata only.manifest.json— Full run status tracking.
For each video, Gemini analyzes both spoken content and visual demonstrations:
| Category | Description |
|---|---|
| Candidate Principles | Principles the creator teaches (with confidence levels) |
| Techniques | Concrete, actionable techniques with steps |
| Visual Observations | Design changes visible on screen (spacing, color, hierarchy, etc.) |
| Coding Observations | Architecture, patterns, debugging approaches |
| Workflows | Step-by-step processes demonstrated |
| Before/After Examples | Modifications with original state, problem, change, result |
| Anti-patterns | Mistakes or bad practices warned against |
| Agent Behaviors | Specific behaviors an AI agent should adopt |
| Skill Candidates | Potential Agent Skills that could be created |
| Uncertainties | Things Gemini isn't sure about (mandatory section) |
Each observation includes confidence levels, evidence types (spoken/visual/both/inferred), and timestamps where available.
- One Gemini call per video (no extra summarization calls)
- Skip already-processed videos by default
- No cross-video Gemini synthesis (done locally via aggregation)
- No automatic re-runs of successful videos
- API token usage is tracked and displayed when available
ai-skill-video-extractor/
app.py # Streamlit UI
README.md
requirements.txt
.env.example
.gitignore
src/
__init__.py
config.py # Configuration & API key handling
schemas.py # Pydantic models for structured output
utils.py # URL parsing, slugs, formatting
youtube.py # yt-dlp metadata extraction
gemini_client.py # Gemini API client with retries
exporter.py # File/directory management
renderer.py # Markdown rendering (no API calls)
index.py # Deduplication index
prompts/
video_extraction_v1.md # The extraction prompt
tests/
test_video_id.py
test_schemas.py
test_exporter.py
test_index.py
exports/
.gitkeep
Run tests (no API key required):
python -m pytest tests/ -vTests cover URL parsing, schema validation, file exports, and index behavior without making any API calls.
- Schema Version:
0.1 - Prompt Version:
video_extraction_v1
Both are recorded in every analysis for tracking when extraction logic improves.
YouTube Video
→ Gemini Analysis (this tool)
→ Structured Evidence Files
→ GPT Review
→ Agent Skill (future phase)
This tool handles steps 1-3. Steps 4-5 are done separately.
- v0.1 processes one video per Gemini request
- No cross-video synthesis by Gemini (done locally via category counting)
- Playlist extraction requires yt-dlp to be working
- Private/unlisted videos may not be accessible to Gemini
- Very long videos may hit token limits on some models
- Visual analysis quality depends on video resolution and content type
Personal utility — not intended for redistribution.