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

youtube-transcript

Skill1 starsChanged 3 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

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use research-prompt, ship-learn-next and 9 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.
  • matyasstochSkill

    research-prompt

    Write a single-paragraph Deep Research prompt to hand to a human researcher (or a deep-research AI). Use when the user wants a research brief, a "deep research prompt", a one-paragraph task for a researcher, or asks "what should our researcher look for". Produces ONE tight paragraph with full context, numbered sub-questions, and per-finding output format.

    Also in 3 projects that use this

  • michalparkolaSkill

    ship-learn-next

    Transform learning content (like YouTube transcripts, articles, tutorials) into actionable implementation plans using the Ship-Learn-Next framework. Use when user wants to turn advice, lessons, or educational content into concrete action steps, reps, or a learning quest.

    Also in 4 projects that use this

  • huskerjeffSkill

    youtube-search

    Search YouTube and extract video metadata and captions using yt-dlp. Use when the user wants to search YouTube, find video transcripts, research topics via YouTube, or feed video content into other tools like NotebookLM.

    Also in 4 projects that use this

  • michalparkolaSkill

    article-extractor

    Extract clean article content from URLs (blog posts, articles, tutorials) and save as readable text. Use when user wants to download, extract, or save an article/blog post from a URL without ads, navigation, or clutter.

    Also in 3 projects that use this

  • MicrosoftSkill

    web-search

    Also in 3 projects that use this

  • GoogleSkill

    teach

    Teach the user a new skill or concept, within this workspace.

    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 50 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 50 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.