编程

YouTube Transcript Native Node

试用

从 YouTube 现有字幕中提取干净的纯文本转录,无需 npm 依赖,无需 API 密钥。

它能做什么

封装 `yt-dlp` 二进制获取 YouTube 字幕,解析 .vtt 字幕文件并去除时间戳与 HTML 标签,输出可读的纯文本或结构化 JSON。原生 Node.js 实现,零 npm 依赖,但要求系统 PATH 上存在 `yt-dlp`。仅接受 YouTube 域名(youtube.com、www.youtube.com、m.youtube.com、youtu.be)的链接,支持语言选择、可选时间戳与自动字幕去重。子进程超时上限 120 秒,输出字符上限 2,000,000。

什么时候用它

  • 从 YouTube 视频提取干净的转录文本用于摘要或笔记
  • 以 JSON 格式输出带时间戳的字幕,供下游研究工具处理
  • 通过时间戳定位引用视频中的特定语句
  • 去除自动字幕中的 VTT 时间戳和 HTML 标签

技能文档

YouTube Transcript (Native Node)

Version: 1.1.5 / public ClawHub utility candidate with external binary and YouTube access.

Minimal YouTube caption extractor. Native Node.js, zero npm dependencies, wraps the external yt-dlp binary.

Risk / invocation class

Risk class: external binary wrapper / YouTube network access / third-party content.

Use deliberately. This skill does not call a web API directly, but yt-dlp talks to YouTube and the local environment owns the yt-dlp PATH/binary supply-chain trust boundary.

Input packet

Required:

  • url: full YouTube URL from the user.
  • goal: raw transcript, summary input, quote extraction, timestamped notes, or JSON handoff.
  • privacy_sensitivity: normal, private/client, or unknown.
  • language: default en unless another language is requested.

Optional:

  • timestamps: needed or not.
  • json: needed for downstream tool use.
  • dedup_preference: default auto-caption rolling-window dedup, or --no-dedup to preserve rolling-window/repeated-phrase artifacts as much as possible. Exact consecutive duplicate cue text may still be collapsed during VTT parsing.
  • output_destination: chat summary, saved file, downstream summarizer, etc.

Stop or ask before use if the video/context is private or client-sensitive and sending access to YouTube via yt-dlp is not appropriate.

Output packet

Return compactly:

  • source YouTube URL
  • language requested and whether timestamps/JSON were used
  • transcript status: success, no captions, dependency missing, private/blocked/rate-limited, or failed
  • whether captions appear auto-generated when known
  • saved path if the transcript was separately written to a file
  • concise transcript summary or excerpt, unless the user requested raw text
  • caveats and next safe step

Security behavior

  • Accepts only http(s) YouTube URLs on youtube.com, www.youtube.com, m.youtube.com, or youtu.be.
  • Validates --lang as a simple subtitle language code beginning with an alphanumeric before invoking yt-dlp.
  • Spawns yt-dlp with an argv array and no shell; it does not execute user-provided commands.
  • Bounds the subprocess with a 120-second timeout.
  • Creates and removes a temporary subtitle directory under the OS temp path.
  • Refuses to print transcripts larger than 2,000,000 characters.
  • Reads no API keys, env secrets, or credential/config files. Offline regression hooks are inert unless YOUTUBE_TRANSCRIPT_SELFTEST=1 is set by scripts/self-test.mjs; do not set self-test hooks for normal transcript extraction.
  • Passes --ignore-config so user-level yt-dlp config does not silently alter wrapper behavior.
  • Static-analysis child_process warnings are expected because this skill intentionally wraps trusted yt-dlp.

When to use

Use this when:

  • the user provides a YouTube URL and wants spoken text/captions;
  • clean plain text is needed for summarization, search, or quoting;
  • the video has creator-uploaded subtitles or auto-generated captions.

Do not use this when:

  • the user expects actual audio transcription; this extracts existing captions only;
  • the platform is not YouTube;
  • the video is a live stream that has not ended;
  • the video/content is privacy-sensitive and should not be accessed via YouTube/yt-dlp;
  • yt-dlp is not installed/on PATH and installing it has not been approved.

Commands

Script: scripts/fetch.mjs

node "\scripts\fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID"
node "\scripts\fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID" --lang es
node "\scripts\fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID" --timestamps
node "\scripts\fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID" --json
node "\scripts\fetch.mjs" --help

POSIX shell examples:

node "/scripts/fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID"
node "/scripts/fetch.mjs" --url "https://www.youtube.com/watch?v=VIDEO_ID" --json

For all flags, dedup details, output formats, dependency notes, and troubleshooting, load references/youtube-transcript-contract.md.

Operating guidance

  • Pass the full user-provided YouTube URL; do not invent/transform URL forms unnecessarily.
  • Default to --lang en unless another language is clear.
  • Use default plain text for direct human reading and summaries.
  • Use --json as the default structured handoff for research triage, summarization, and downstream tooling.
  • Use --timestamps only when timestamped notes, quote traceability, or debugging are needed; it is an advanced/evidence mode, not the recommended default for reading.
  • Use --json --timestamps only for machine traceability workflows that need timestamp anchors inside JSON; it is not intended as a human-readable inspection format.
  • Save long transcripts to a file when useful; do not paste giant transcripts unless requested.
  • Summarize first and quote sparingly by default.
  • Respect copyright and platform terms; do not republish long/full transcripts unless the user has rights or permission.
  • Note that captions may be auto-generated and imperfect.

Required checks before publishing/updating

Minimum no-video/no-network checks:

node --check skills\youtube-transcript-native-node\scripts\fetch.mjs
node skills\youtube-transcript-native-node\scripts\self-test.mjs
node skills\youtube-transcript-native-node\scripts\fetch.mjs --help
node skills\youtube-transcript-native-node\scripts\fetch.mjs --url "https://example.com/watch?v=not-youtube" --json

The invalid-host smoke should fail before invoking yt-dlp.

Optional environment check:

yt-dlp --version

Do not install/update yt-dlp as part of this skill without explicit approval.

Public registry exposure

Classification: public ClawHub utility candidate with external binary + YouTube access.

Before public update, run sanitizer/static checks and ensure docs clearly disclose:

  • yt-dlp dependency and PATH/binary trust boundary;
  • YouTube-only URL allowlist;
  • no API keys/env secrets/config reads;
  • temp-directory behavior and stderr temp-path scrubbing;
  • no audio/video download and no audio transcription;
  • expected child_process static-analysis warning.
  • best-effort scrub of temp- and home-directory paths from the last lines of yt-dlp stderr; unrelated absolute paths emitted by yt-dlp itself may remain.

Respect copyright and platform terms in examples, docs, and outputs: prefer summaries and brief quotes; do not publish long/full third-party transcripts unless rights or permission are clear.

Do not include private/internal/client strategy, operator-specific operational notes, or full third-party transcript samples in a public release.

Changelog

  • 1.1.5: Input/docs polish: require --lang to begin with an alphanumeric, add POSIX command examples, sync reference changelog, and neutralize process wording. No categories, topics, topic tags, tags, keywords, or ClawHub catalog metadata added to source.
  • 1.1.4: Version refresh; no runtime behavior change.
  • 1.1.3: Add stubbed offline yt-dlp fixture tests for dependency-missing, nonzero-exit-with-VTT, 429 hint, temp/home path scrubbing, output-size guard, timeout, and output modes; gate self-test hooks behind YOUTUBE_TRANSCRIPT_SELFTEST=1; continue when usable VTT subtitles are produced despite nonzero yt-dlp exit; kill active yt-dlp child on SIGINT/SIGTERM; broaden local-path scrubbing and scrub unexpected/read-error paths.
  • 1.1.2: Add offline self-test fixtures, export parser/allowlist helpers for tests, pass --ignore-config, remove subtitle conversion postprocessor to avoid ffmpeg ambiguity, scrub temp path from yt-dlp error tails, and surface 429 retry guidance.
  • 1.1.1: Docs cleanup: normalized input/output packet wording, structured handoff wording, and changelog language; no runtime behavior change.

常见问题

它能转录音频吗?
不能。它只提取 YouTube 现有字幕(创作者上传或自动生成),不会下载或转录音频。
需要预先安装什么?
不需要任何 npm 包。技能依赖 PATH 上的 `yt-dlp` 二进制,未经明确批准请勿安装或更新它。
支持哪些网站和视频?
仅支持 YouTube(youtube.com、www.youtube.com、m.youtube.com、youtu.be)。未结束的直播不在支持范围。
会读取 API 密钥或敏感配置吗?
不会。它不读取任何 API 密钥、环境变量中的密钥或凭证/配置文件,并通过 `--ignore-config` 避免用户级 yt-dlp 配置影响封装行为。

相关技能

把 YouTube 视频整理成带章节、时间戳和要点的 Markdown 摘要

59 次安装1 星标

YouTube transcript extraction and content reformatting: given a YouTube video URL, opens the video's transcript panel, extracts all timestamped segments, and...

3 次安装

Reach for this whenever a task touches YouTube, said or unsaid: pasted video/channel/playlist links, IDs and @handles, summaries, quotes, translations, topic research through talks and tutorials, creator monitoring. The full TranscriptOut surface: transcripts in five formats, search, channels, playlists and batch jobs. Skip it for uploads and account chores.

Pulls structured YouTube data — video and channel details, transcripts/captions, comments, playlists, and search — via the Crawlora API as clean JSON, with no yt-dlp or HTML scraping. Use when the user provides a YouTube URL or asks for a transcript, comments, channel/video metadata, or video search results.

1 次安装

Fetch YouTube video transcripts, search YouTube, list channel or playlist videos, and track new uploads via the BulkTranscripts API. Use when the user shares a YouTube link, asks to summarize/analyze/quote a video, wants transcripts for a whole channel or playlist, needs YouTube research, or asks what a channel posted recently. Works immediately with no API key (free tier); set BULKTRANSCRIPTS_API_KEY for purchased credits.

2 次安装1 星标