Youtube Transcript

作者 intellectronica9b0e00ad1b94无许可证295 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5个月前更新

Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com/watch?v=, youtu.be/, or similar). Supports output with or without timestamps.

AI 生成的概览

从 YouTube 链接或视频 ID 提取视频文字稿或字幕,可选带时间戳。

功能
使用 youtube-transcript-api 获取 YouTube 视频的自动生成或人工添加字幕。它接受 YouTube 链接或 11 位原始视频 ID,输出纯文本(每个字幕片段一行),或输出 [MM:SS] 或 [HH:MM:SS] 格式的带时间戳文本。文字稿可保存到指定文件,或默认保存为以视频 ID 加 -transcript.txt 后缀命名的文件。
适用场景
当用户提供 YouTube 链接或视频 ID,并要求获取该视频的文字稿、字幕或说明文字时使用。适用于需要以纯文本或带时间戳形式获取字幕内容,并可选保存到文件的场景。
运行要求
需要 youtube-transcript-api 包,以及可运行所附脚本的 Python 运行时和 uv。需要访问 YouTube 的网络连接,且目标视频必须启用字幕。

YouTube Transcript

Extract transcripts from YouTube videos using the youtube-transcript-api.

Usage

Run the script with a YouTube URL or video ID:

bash
uv run scripts/get_transcript.py "VIDEO_URL_OR_ID"

With timestamps:

bash
uv run scripts/get_transcript.py "VIDEO_URL_OR_ID" --timestamps

Defaults

  • Without timestamps (default): Plain text, one line per caption segment
  • With timestamps: [MM:SS] text format (or [HH:MM:SS] for longer videos)

Supported URL Formats

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://youtube.com/embed/VIDEO_ID
  • Raw video ID (11 characters)

Output

  • CRITICAL: YOU MUST NEVER MODIFY THE RETURNED TRANSCRIPT
  • If the transcript is without timestamps, you SHOULD clean it up so that it is arranged by complete paragraphs and the lines don't cut in the middle of sentences.
  • If you were asked to save the transcript to a specific file, save it to the requested file.
  • If no output file was specified, use the YouTube video ID with a -transcript.txt suffix.

Notes

  • Fetches auto-generated or manually added captions (whichever is available)
  • Requires the video to have captions enabled
  • Falls back to auto-generated captions if manual ones aren't available

来源与署名

来源:intellectronica/agent-skills位于skills/youtube-transcript提交9b0e00a

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架