---
name: youtube-transcript
description: >
  Fetch, analyze, and archive YouTube video transcripts. Use when the user shares a YouTube link, URL, or video ID.
  Automatically: fetches transcript → analyzes content → determines the right persona and note category → saves a structured fact-card to the knowledge library.
  Supports Turkish and English. No API key needed.
---

# YouTube Transcript — Fetch, Analyze & Archive

When the user shares a YouTube link, execute this full pipeline automatically.

## Pipeline

### Step 1: Fetch Transcript

Run the script to get the transcript:

```bash
python3 {baseDir}/scripts/yt-transcript.py "VIDEO_URL" --lang tr,en --format text
```

If Turkish subtitles aren't available, try auto-translation:

```bash
python3 {baseDir}/scripts/yt-transcript.py "VIDEO_URL" --translate tr --format text
```

If both fail, try listing available languages:

```bash
python3 {baseDir}/scripts/yt-transcript.py "VIDEO_URL" --list-langs
```

### Step 2: Analyze & Classify

After fetching the transcript, analyze the content and determine:

1. **Topic Category** — Which region/subject folder does this belong to?
   - Iran, Russia, China, USA, Suriye, Lübnan, Irak, Sudan, Pakistan, Mısır, NATO
   - BAM (Geopolitics lectures/seminars)
   - Intelligence and National Security
   - If it doesn't fit any: save to the closest match or create a new subfolder

2. **Persona Match** — Which persona should process this?
   - **Frodo** — Geopolitics, conflict analysis, strategic intelligence, Iran/Russia/Middle East
   - **Neo** — Cybersecurity, hacking, APT groups, CVEs, offensive/defensive security
   - **Ghost** — Propaganda, PSYOP, information warfare, media manipulation, cognitive security
   - **Oracle** — OSINT techniques, digital forensics, social media investigation
   - **Scholar** — Academic content, IR theory, methodology, book reviews, lectures
   - **Architect** — DevOps, infrastructure, systems engineering

3. **Content Type** — What kind of content is this?
   - `lecture` — University/seminar lecture
   - `analysis` — Geopolitical/security analysis
   - `interview` — Expert interview
   - `documentary` — Documentary
   - `tutorial` — How-to/technical tutorial
   - `news` — News report/commentary
   - `debate` — Panel discussion/debate

### Step 3: Generate Structured Note

Create a fact-card style markdown note with this format:

```markdown
---
type: youtube-transcript
topic: [determined-topic]
persona: [matched-persona]
content_type: [lecture|analysis|interview|etc]
video_id: [VIDEO_ID]
url: https://www.youtube.com/watch?v=[VIDEO_ID]
language: [tr|en]
date: [YYYY-MM-DD]
confidence: medium
---

# [Video Title or Topic Summary]

## Özet
[3-5 cümlelik Türkçe özet — videonun ana argümanı/mesajı ne?]

## Ana Noktalar
- [Bullet point 1 — en önemli bulgu/argüman]
- [Bullet point 2]
- [Bullet point 3]
- [...]

## Önemli Alıntılar
> "[Önemli bir alıntı, varsa timestamp ile]" — [Konuşmacı]

## Analiz Notu
[1-2 paragraf: Bu video neden önemli? Hangi bağlama oturuyor?
Frodo ise: stratejik değerlendirme, tehdit analizi
Neo ise: teknik güvenlik değerlendirmesi
Ghost ise: bilgi savaşı / propaganda analizi
Scholar ise: akademik bağlam, kaynak değerlendirmesi]

## Bağlantılar
- Mevcut notlarla ilişki (varsa)
- İlgili konular ve referanslar

## Ham Transkript (Özet)
[Transkriptin kısaltılmış versiyonu — en önemli bölümler, max 2000 karakter]
```

### Step 4: Save to Knowledge Library

Save the note to the appropriate directory:

```
/home/ali0606/notes/geopolitics/notlar/[CATEGORY]/yt-[VIDEO_ID].md
```

Category mapping:
- Iran topics → `Iran/`
- Russia/Ukraine → `Russia/`
- Syria → `Suriye/`
- Lebanon/Hezbollah → `Lübnan/`
- Iraq/PMF → `Irak/`
- China/Asia → `China/`
- USA/NATO → `USA/` or `NATO/`
- Cybersecurity → `/home/ali0606/notes/cybersec/`
- Academic/IR Theory → `BAM/` or `Intelligence and National Security/`
- General geopolitics → save to most relevant existing folder

After saving, report to the user:
- 📺 Video summary (3 sentences)
- 🏷️ Category & persona used
- 📁 File path where saved
- 🔑 Key takeaways (3 bullets)

## Options

The user can override defaults:

- `--lang XX` — Force specific subtitle language
- `--translate XX` — Auto-translate to language
- `--no-save` — Just show analysis, don't save
- `--persona X` — Force specific persona for analysis
- `--raw` — Show full raw transcript instead of analyzed note

## Notes

- Always prefer Turkish subtitles when available
- If video is in English, auto-translate to Turkish for the summary
- The full raw transcript should NOT be saved — only the structured note
- Keep the note concise: max 500 words for the structured part
- If the transcript is too long (>50K chars), summarize the key sections only
- Update the region INDEX.md after saving a new note
