agentleFS
THEROCKSSSTHEROCKSSS/hermes-skills-portfolio/skills/youtube-transcript/SKILL.md

youtube-transcript

Skill1 starsChanged 4 months agoMITView on GitHub

Use when the user wants the text content of a YouTube video — the full transcript, timestamped segments, a search for a specific topic within the video, or a summary/quote — from a URL or bare video ID.

  • Installs packages

36 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use markdown-converter, context7 and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • bongartzdiazSkill

    markdown-converter

    Convert documents and files to Markdown using markitdown. Use when converting PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx, .xls), HTML, CSV, JSON, XML, images (with EXIF/OCR), audio (with transcription), ZIP archives, YouTube URLs, or EPubs to Markdown format for LLM processing or text analysis.

    Also in 3 projects that use this

  • bongartzdiazSkill

    context7

    Retrieve up-to-date documentation for software libraries, frameworks, and components via the Context7 API. This skill should be used when looking up documentation for any programming library or framework, finding code examples for specific APIs or features, verifying correct usage of library functions, or obtaining current information about library APIs that may have changed since training.

    Also in 4 projects that use this

  • ttmouseSkill

    notebooklm

    Automate Google NotebookLM - create notebooks, add sources, generate podcasts/videos/quizzes, download artifacts. Supports browser-based content extraction for anti-crawler platforms (Twitter/X, LinkedIn, etc.). Activates on explicit /notebooklm or intent like "create a podcast about X

    Also in 3 projects that use this

  • MicrosoftSkill

    skill-creator

    Guide for creating effective GitHub Copilot skills (.github/skills/) in this repository. Use when creating a new skill, updating an existing skill, or when asked about skill structure, format, or best practices for the vscode-documentdb project.

    Also in 7 projects that use this

  • MicrosoftSkill

    mcp-builder

    Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

    Also in 3 projects that use this

  • AWSSkill

    grill-me

    A relentless interview to sharpen a plan or design.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 30 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Calling get_transcript without a fallback: Not all videos have captions — it raises NoTranscriptFound.

    line 128
  2. Very specific:

    Hardcoding languages=["en"] for non-English content: If the requested language isn't present, get_transcript raises rather than falling …

    line 138

“Common” is measured: kept by at least 6 in 10 of the 30 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

youtube-transcript

Overview

Fetch transcripts from YouTube videos. The agent retrieves the video's caption track, cleans the text, and returns it as plain text or structured segments with timestamps.

When to Use

  • The user wants the text content of a YouTube video.
  • The user wants to search for a specific topic within a video.
  • The user wants to summarize or quote a video.
  • The user says "get the transcript", "what does this video say", or "extract the captions".

Prerequisites

pip install youtube-transcript-api

Basic Transcript

from youtube_transcript_api import YouTubeTranscriptApi

def get_transcript(video_id: str, lang: str = "en") -> str:
    """Get the full transcript as plain text."""
    transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=[lang])
    return " ".join([snippet["text"] for snippet in transcript])

With Timestamps

def get_transcript_with_timestamps(video_id: str, lang: str = "en") -> list:
    """Get transcript as a list of {start, duration, text} dicts."""
    transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=[lang])
    return [
        {
            "start": snippet["start"],
            "end": snippet["start"] + snippet["duration"],
            "text": snippet["text"]
        }
        for snippet in transcript
    ]

Extract Video ID from URL

import re

def extract_video_id(url: str) -> str:
    patterns = [
        r"(?:youtube\.com/watch\?v=|youtu\.be/|youtube\.com/embed/)([a-zA-Z0-9_-]{11})",
        r"youtube\.com/shorts/([a-zA-Z0-9_-]{11})",
    ]
    for pattern in patterns:
        match = re.search(pattern, url)
        if match:
            return match.group(1)
    # Maybe it's already just the ID
    if re.match(r"^[a-zA-Z0-9_-]{11}$", url):
        return url
    raise ValueError(f"Could not extract video ID from: {url}")

Full Workflow

# 1. Get video ID from URL
video_id = extract_video_id("https://www.youtube.com/watch?v=dQw4w9WgXcQ")

# 2. Get transcript
transcript = get_transcript(video_id)

# 3. Optionally save to file
with open("transcript.txt", "w") as f:
    f.write(transcript)

Search Within Transcript

def search_transcript(video_id: str, query: str, lang: str = "en") -> list:
    """Find segments containing a query string."""
    transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=[lang])
    query_lower = query.lower()
    matches = []
    for snippet in transcript:
        if query_lower in snippet["text"].lower():
            matches.append({
                "timestamp": snippet["start"],
                "text": snippet["text"]
            })
    return matches

Translate Non-English Transcripts

from youtube_transcript_api import YouTubeTranscriptApi

def get_transcript_any_language(video_id: str) -> str:
    """Get transcript in any available language."""
    transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
    for transcript in transcript_list:
        try:
            return " ".join([s["text"] for s in transcript.fetch()])
        except:
            continue
    raise ValueError("No transcript available in any language")

Common Pitfalls

  1. Calling get_transcript without a fallback. Not all videos have captions — it raises NoTranscriptFound. Call list_transcripts first to check what's actually available before assuming a fixed lang.
  2. Treating auto-generated captions as manual-quality. YouTube auto-captions are usually available but less accurate (misheard words, no punctuation) — don't present them as a verbatim transcript without noting the source.
  3. Fetching many videos back-to-back with no delay. YouTube rate-limits frequent requests; space out multiple fetches or batch jobs will start failing partway through.
  4. Assuming VideoUnavailable means a transient error. It means the video is private or deleted — retrying won't help; report it as unavailable to the user.
  5. Hardcoding languages=["en"] for non-English content. If the requested language isn't present, get_transcript raises rather than falling back — use list_transcripts to discover available (including auto-translated) languages first.
  6. Returning raw transcript text with HTML entities intact. Segments can contain &, ', etc. — run html.unescape() before presenting the text.

Verification Checklist

  • extract_video_id correctly parses the actual URL format given (watch, youtu.be, embed, or shorts) before fetching.
  • list_transcripts was checked when the first get_transcript call fails, rather than immediately reporting failure to the user.
  • Returned text has no raw HTML entities (&, ') left unescaped.
  • Timestamped output (if requested) has start/end values that increase monotonically and cover the video's actual duration.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.