Loading...
Loading...
Extract subtitles/transcripts from a YouTube video URL and save as a local file. Use when you need to extract subtitles from a YouTube video.
npx skill4agent add feiskyer/codex-settings youtube-transcribe-skillyoutube.com/watch?v=youtu.be/yt-dlpyt-dlp --get-title "[VIDEO_URL]"document.titlewhich yt-dlpyt-dlpyt-dlpyt-dlp--cookies-from-browserchromeyt-dlpfirefoxsafariedge# Get the title first (try chrome first)
yt-dlp --cookies-from-browser=chrome --get-title "[VIDEO_URL]"
# Download subtitles
yt-dlp --cookies-from-browser=chrome --write-auto-sub --write-sub --sub-lang zh-Hans,zh-Hant,en --skip-download --output "<Video Title>.%(ext)s" "[VIDEO_URL]"yt-dlpchrome-devtools-mcpmcp__chrome__new_pagechrome-devtools-mcpyt-dlpyt-dlpchrome-devtools-mcpmcp__chrome__new_pagemcp__chrome__take_snapshotmcp__chrome__clickmcp__chrome__take_snapshotmcp__chrome__clickmcp__chrome__evaluate_script() => {
// Select all transcript segment containers
const segments = document.querySelectorAll("ytd-transcript-segment-renderer");
if (!segments.length) return "BUFFERING"; // Retry if empty
// Iterate and format as "timestamp text"
return Array.from(segments)
.map((seg) => {
const time = seg.querySelector(".segment-timestamp")?.innerText.trim();
const text = seg.querySelector(".segment-text")?.innerText.trim();
return `${time} ${text}`;
})
.join("\n");
};<Video Title>.txtmcp__chrome__close_page<Video Title>.txtTimestamp Subtitle Text