Subhadip Sarkar

YouTube Transcript (yt-dlp captions)

資料分析v1.0.5
作者:Subhadip Sarkar更新於 2026-05-17共 6 個版本 · 最新版本釋出於 2026-02-14youtube-transcript-yt-dlp@clawhub_itzsubhadip/youtube-transcript-yt-dlp
網頁抓取#Sqlite

據 AlphaMoat 統計,截至 2026-09,YouTube Transcript (yt-dlp captions) 累計下載 3,713 次、獲 0 個星標,在全部 5,078 個 AI 技能中排名第 2,885 位,在「資料分析」分類(399 個)中排名第 219 位。

累計安裝
118
累計下載
3713
星標
-
全站排名
#2,885
全站前 57% · 「資料分析」前 55%
平台累計安裝累計下載星標評論
ClawHub ↗1183707--
SkillHub ↗1173713-—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

該技能使用 yt-dlp,優先手動字幕,再回退到自動字幕;沒有字幕時可能嘗試 YouTube transcript panel。主文說明此版本不會呼叫第三方轉錄服務,只直接訪問 YouTube。若需 cookies.txt,必須將 cookies 視為機密。

資料釋出於 2026-10-29

可以用來做什麼

  • 將 YouTube 字幕轉為文字以便總結或搜尋
  • 按需保留時間戳或快取結果

什麼時候用

  • 使用者提供 YouTube 連結並需要字幕文字或摘要輸入時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

說明此技能如何從現有字幕獲取文字,以及字幕缺失時的限制;不要訪問影片。

月度資料趨勢

累計下載3713
1780281838562026-03 · 累計下載 19232026-05 · 累計下載 29112026-06 · 累計下載 30702026-07 · 累計下載 33852026-08 · 累計下載 35642026-09 · 累計下載 371326-0326-09
星標-
0112026-03 · 星標 -2026-05 · 星標 -2026-06 · 星標 -2026-07 · 星標 -2026-08 · 星標 -2026-09 · 星標 -26-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-093713—-
2026-083564+5.3%-
2026-073385+10.3%-
2026-063070+5.5%-
2026-052911—-
2026-031923—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

3.8 KB · ClawHub v1.0.5
---
name: yt_transcript
description: Extract YouTube video transcripts from existing captions (manual or auto-generated) using yt-dlp, with optional timestamps and local SQLite caching. Use when the user asks for a YouTube transcript, captions, subtitles, or wants to turn a YouTube link into text for summarization/search.
metadata: {"openclaw":{"requires":{"bins":["python3","yt-dlp"]},"os":["linux","darwin","win32"]}}
user-invocable: true
---

# YouTube Transcript (Captions-Only)

This skill extracts transcripts from **existing** YouTube captions.
展開全部(共 95 行)

**Primary behavior**
- Prefer **manual subtitles** when available.
- Fall back to **auto-generated captions**.
- Output either:
  - **JSON** segments (default) or
  - **plain text** (`--text`)
- Cache results locally in **SQLite** for speed.

**Reliability behavior**
- If YouTube blocks anonymous access (bot-check), provide **cookies.txt**.
- If `yt-dlp` reports no captions for a video, the script tries a fallback:
  1) YouTube’s **transcript panel** (youtubei `get_transcript`) when accessible

This published version intentionally **does not** call third-party transcript providers.

**Privacy note:** This published version only contacts YouTube directly (via `yt-dlp` and the transcript panel fallback). It does **not** send video IDs/URLs to third-party transcript providers.

**Cookies:** Cookies are treated as secrets.
- The script supports `--cookies` / `YT_TRANSCRIPT_COOKIES`, but does **not** auto-load cookies from inside the skill directory.
- Store cookies under `~/.config/yt-transcript/`.

**Path safety:** This skill restricts `--cookies` and `--cache` paths to approved directories.
- cookies allowed under: `~/.config/yt-transcript/`
- cache allowed under: `{baseDir}/cache/` and `~/.config/yt-transcript/`

## How to run

Script path:
- `{baseDir}/scripts/yt_transcript.py`

Typical usage:
- `python3 {baseDir}/scripts/yt_transcript.py <youtube_url_or_id>`
- `python3 {baseDir}/scripts/yt_transcript.py <url> --lang en`
- `python3 {baseDir}/scripts/yt_transcript.py <url> --text`
- `python3 {baseDir}/scripts/yt_transcript.py <url> --no-ts`

Cookies (optional, but often required on VPS IPs):
- `python3 {baseDir}/scripts/yt_transcript.py <url> --cookies /path/to/youtube-cookies.txt`
- or set env var: `YT_TRANSCRIPT_COOKIES=/path/to/youtube-cookies.txt`

**Publishing safety note:** Cookies are optional, so `YT_TRANSCRIPT_COOKIES` is intentionally **not required** by skill metadata. Only set it if you need authenticated access.

**Best practice:** store cookies **outside** the skill folder (so you never accidentally publish them), e.g. `~/.config/yt-transcript/youtube-cookies.txt`, and point to it via `--cookies` or `YT_TRANSCRIPT_COOKIES`.

## What the script returns

### JSON mode (default)
A JSON object:
- `video_id`: 11-char id
- `lang`: chosen language
- `source`: `manual` | `auto` | `panel`
- `segments`: list of `{ start, duration, text }` (or text-only when `--no-ts`)

### Text mode (`--text`)
A newline-separated transcript.
- By default timestamps are included as `[12.34s]`.
- Use `--no-ts` to output only the text lines.

## Caching

Default cache DB:
- `{baseDir}/cache/transcripts.sqlite`

Cache key includes:
- `video_id`, `lang`, `source`, `include_timestamp`, `format`

## Cookie handling (important)

- Cookies must be in **Netscape cookies.txt** format.
- Treat cookies as **secrets**.
- **Never commit / publish cookies** to ClawHub.

Recommended local path (ignored by git/publish):
- `{baseDir}/cache/youtube-cookies.txt` (chmod 600)

## Notes (safety + reliability)

- Only accept a YouTube URL or an 11-character video ID.
- Do not forward arbitrary user-provided flags into the command.
- If `yt-dlp` is missing, instruct the user to install it (recommended):
  - install pipx
  - `pipx install yt-dlp`
  - ensure `yt-dlp` is on PATH

「資料分析」分類下的熱門技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。