AgentSkillsCN

youtube-notes

扩展并维护Smart Notes(YouTube笔记)工具。适用于为YouTube笔记应用添加新功能、调整转录或摘要行为、接入LLM后端(如Ollama),或参与Smart Notes项目的开发与优化。

SKILL.md
--- frontmatter
name: youtube-notes
description: Extends and maintains the Smart Notes (YouTube Notes) tool. Use when adding features to the YouTube notes app, changing transcript or summarization behavior, adding LLM backends (e.g. Ollama), or working on the Smart Notes project.

YouTube Notes — Project Skill

Project Context

  • App: Single Streamlit script at app.py. Run: streamlit run app.py from repo root.
  • Flow: Paste URLs → extract video ID (regex for youtube.com/watch?v=ID, youtu.be/ID) → fetch transcript via YouTubeTranscriptApi.get_transcript → summarize with Groq (llama-3.1-8b-instant).
  • Env: GROQ_API_KEY in .env; if unset, app shows transcript only and warns.

When Adding Features

  1. New URL formats: Extend the regex in YOUTUBE_ID_PATTERN or the logic in extract_video_id; keep invalid-URL handling and user-facing "Invalid YouTube URL."
  2. New LLM backend (e.g. Ollama): Add a branch in the summarization path (e.g. check env like USE_OLLAMA or model choice); call Ollama API or local endpoint with the same prompt used for Groq; keep transcript fetch and error handling unchanged.
  3. Export (copy / download): Add a Streamlit control (e.g. st.download_button or copy-to-clipboard) that uses the current notes text; do not change transcript or summarization logic.
  4. Transcript-only mode: Already supported when GROQ_API_KEY is unset; optional: add an explicit "Show transcript only" toggle that skips the Groq call when set.

Conventions to Preserve

  • Transcript: youtube-transcript-api only; no YouTube Data API, no Whisper unless explicitly requested.
  • One summarization prompt tuned for programming notes (bullets, concepts, takeaways).
  • ~1.5 s delay between transcript requests for multiple URLs.
  • Errors: "This video has no captions available." for missing transcript; "Invalid YouTube URL." for bad URLs.

Key Files

  • app.py — UI, URL parsing, transcript fetch, Groq summarization
  • AGENTS.md — Layout, conventions, quick reference
  • README.md — Setup and usage for users