Skip to content
Back to skills

Youtube Transcript

ASecurity

Retrieve the transcript text from a YouTube video given a URL or video ID.

  • 42 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agentspythonapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 4 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add tsukhani/jclaw --skill youtube-transcript --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Youtube Transcript?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Youtube Transcript
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tsukhani-youtube-transcript/badge)](https://www.skillsdirectory.com/skills/tsukhani-youtube-transcript)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: youtube-transcript
description: >-
  Retrieve the transcript text from a YouTube video given a URL or video ID.
metadata:
  version: "1.0.4"
  author: main
  jclaw-icon: "📝"
  jclaw-tools: exec filesystem
  jclaw-commands: ""
---

# YouTube Transcript

When asked to retrieve a transcript from a YouTube video:

1. **Extract the video ID**
   - If the user provides a full URL (e.g. `https://www.youtube.com/watch?v=VIDEO_ID` or `https://youtu.be/VIDEO_ID`), parse out the 11-character video ID.
   - If the user provides just the raw video ID, use it directly.

2. **Fetch the transcript**
   - Use the `exec` tool to run a one-liner Python script that calls the `youtube_transcript_api` library:
     ```python3 -c "from youtube_transcript_api import YouTubeTranscriptApi; api=YouTubeTranscriptApi(); t=api.fetch('VIDEO_ID'); print('TOTAL:{}'.format(len(t))); [print('{:06.2f}|{}'.format(s.start, s.text)) for s in t]"```
     - The output is a series of lines: `TOTAL:508` followed by entries like `72.50|Hello world`
   - If it fails with `ModuleNotFoundError`, the library is missing: run `python3 -m pip install "youtube-transcript-api==1.2.4" --quiet` once with `exec`, then run the fetch again. Install only then, and only this version, which is the one the skill is tested with.
   - If the library raises any other error (e.g. `TranscriptsDisabled`, `NoTranscriptFound`, or connectivity issues), report the error text concisely and stop.

3. **Parse the response**
   - Split the output by lines.
   - Skip the `TOTAL:` line (used only for verification).
   - For each remaining line: split on the first `|` — the left side is the timestamp in seconds (float), the right side is the caption text. Decode HTML entities on the caption text (e.g. `&amp;` → `&`, `&quot;` → `"`, `&#39;` → `'`, `&lt;` → `<`, `&gt;` → `>`).
   - Format each timestamp as `[MM:SS]` from the float seconds (e.g. `72.50` → `[01:12]`).
   - Combine each caption into a single line: `[MM:SS] {decoded_text}`.
   - Join all lines with a newline into the final transcript string.

4. **Deliver the result**
   - If the combined transcript exceeds 4000 characters, save it to a file:
     - Create the directory `youtube-transcript/` at the root of the workspace if it doesn't exist.
     - Write the content to `youtube-transcript/{VIDEO_ID}-transcript.txt` using the `filesystem` tool.
     - Report back with a markdown file link: `[{VIDEO_ID}-transcript.txt](<youtube-transcript/{VIDEO_ID}-transcript.txt>)`
   - If the transcript is short, return it directly in chat wrapped in a markdown code block for readability.

5. **Error handling**
   - If the library or transcript fetch fails, report the error text concisely.
   - If the video has no captions/transcript available, report this plainly to the user.
   - Be concise and factual when reporting errors.

**Output Location:** If this skill generates files, they are written to `youtube-transcript/` at the root of the agent's workspace (e.g., `youtube-transcript/abc123-transcript.txt`).

Files in this skill

  • SKILL.md1.5 KB
  • references/SETUP.md2.5 KB
  • scripts/fetch_transcript.py4.5 KB
  • skill-card.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.