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 從公開儲存庫中收錄這些內容。

檢舉或申請下架