youtube-transcribe-skill

105
7
Source

Extract subtitles/transcripts from a YouTube video URL and save as a local file. Use when you need to extract subtitles from a YouTube video.

Install

mkdir -p .claude/skills/youtube-transcribe-skill && curl -L -o skill.zip "https://mcp.directory/api/skills/download/94" && unzip -o skill.zip -d .claude/skills/youtube-transcribe-skill && rm skill.zip

Installs to .claude/skills/youtube-transcribe-skill

About this skill

YouTube Transcript Extraction

Extract subtitles/transcripts from a YouTube video URL and save them as a local file.

Input YouTube URL: $ARGUMENTS

Step 1: Verify URL and Get Video Information

  1. Verify URL Format: Confirm the input is a valid YouTube URL (supports youtube.com/watch?v= or youtu.be/ formats).

  2. Get Video Information: Use WebFetch or firecrawl to fetch the page and extract the video title for subsequent file naming.

Step 2: CLI Quick Extraction (Priority Attempt)

Use command-line tools to quickly extract subtitles.

  1. Check Tool Availability: Execute which yt-dlp.

    • If yt-dlp is found, proceed to subtitle download.
    • If yt-dlp is NOT found, skip immediately to Step 3.
  2. Execute Subtitle Download (Only if yt-dlp is found):

    • Tip: Always add --cookies-from-browser to avoid sign-in restrictions. Default to chrome.
    • Retry Logic: If yt-dlp fails with a browser error (e.g., "Could not open Chrome"), ask the user to specify their available browser (e.g., firefox, safari, edge) and retry.
    # Get the title first (try chrome first)
    yt-dlp --cookies-from-browser=chrome --get-title "[VIDEO_URL]"
    
    # Download subtitles
    yt-dlp --cookies-from-browser=chrome --write-auto-sub --write-sub --sub-lang zh-Hans,zh-Hant,en --skip-download --output "<Video Title>.%(ext)s" "[VIDEO_URL]"
    
  3. Verify Results:

    • Check the command exit code.
    • Exit code 0 (Success): Subtitles have been saved locally, task complete.
    • Exit code non-0 (Failure):
      • If error is related to browser/cookies, ask user for correct browser and retry Step 2.
      • If other errors (e.g., video unavailable), proceed to Step 3.

Step 3: Browser Automation (Fallback)

When the CLI method fails or yt-dlp is missing, use browser UI automation to extract subtitles.

  1. Check Tool Availability:

    • Check if chrome-devtools-mcp tools (specifically mcp__plugin_claude-code-settings_chrome__new_page) are available.
    • CRITICAL CHECK: If chrome-devtools-mcp is NOT available AND yt-dlp was NOT found in Step 2:
      • STOP execution.
      • Notify the User: "Unable to proceed. Please either install yt-dlp (for fast CLI extraction) OR configure chrome-devtools-mcp (for browser automation)."
  2. Initialize Browser Session (If tools are available):

    Call mcp__plugin_claude-code-settings_chrome__new_page to open the video URL.

3.2 Analyze Page State

Call mcp__plugin_claude-code-settings_chrome__take_snapshot to read the page accessibility tree.

3.3 Expand Video Description

Reason: The "Show transcript" button is usually hidden within the collapsed description area.

  1. Search the snapshot for a button labeled "...more", "...更多", or "Show more" (usually located in the description block below the video title).
  2. Call mcp__plugin_claude-code-settings_chrome__click to click that button.

3.4 Open Transcript Panel

  1. Call mcp__plugin_claude-code-settings_chrome__take_snapshot to get the updated UI snapshot.
  2. Search for a button labeled "Show transcript", "显示转录稿", or "内容转文字".
  3. Call mcp__plugin_claude-code-settings_chrome__click to click that button.

3.5 Extract Content via DOM

Reason: Directly reading the accessibility tree for long lists is slow and consumes many tokens; DOM injection is more efficient.

Call mcp__plugin_claude-code-settings_chrome__evaluate_script to execute the following JavaScript:

() => {
  // Select all transcript segment containers
  const segments = document.querySelectorAll("ytd-transcript-segment-renderer");
  if (!segments.length) return "BUFFERING"; // Retry if empty

  // Iterate and format as "timestamp text"
  return Array.from(segments)
    .map((seg) => {
      const time = seg.querySelector(".segment-timestamp")?.innerText.trim();
      const text = seg.querySelector(".segment-text")?.innerText.trim();
      return `${time} ${text}`;
    })
    .join("\n");
};

If it returns "BUFFERING", wait a few seconds and retry.

3.6 Save and Cleanup

  1. Use the Write tool to save the extracted text as a local file (e.g., <Video Title>.txt).
  2. Call mcp__plugin_claude-code-settings_chrome__close_page to release resources.

Output Requirements

  • Save the subtitle file to the current working directory.
  • Filename format: <Video Title>.txt
  • File content format: Each line should be Timestamp Subtitle Text.
  • Report upon completion: File path, subtitle language, total number of lines.

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

297790

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

220415

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

215297

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

224234

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

175201

rust-coding-skill

UtakataKyosui

Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.

167173

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.