Skip to content

Instantly share code, notes, and snippets.

@jongan69
Created October 26, 2025 02:52
Show Gist options
  • Select an option

  • Save jongan69/d4a7357d00cbd2a280982baaa012485d to your computer and use it in GitHub Desktop.

Select an option

Save jongan69/d4a7357d00cbd2a280982baaa012485d to your computer and use it in GitHub Desktop.
A browser console log script for getting the transcript from a video
(() => {
// Select all transcript segments
const segments = document.querySelectorAll('ytd-transcript-segment-renderer');
if (!segments.length) {
console.error("❌ No transcript segments found. Make sure the transcript panel is open.");
return;
}
// Extract only the text from each segment
const transcript = Array.from(segments)
.map(seg => seg.querySelector('.segment-text')?.innerText.replace(/\s+/g, ' ').trim() || '')
.join(' ');
// Output to console
console.log("🎬 FULL VIDEO TRANSCRIPT (no timestamps):\n\n" + transcript);
// Copy to clipboard
navigator.clipboard.writeText(transcript)
.then(() => console.log("✅ Transcript copied to clipboard!"))
.catch(() => console.warn("⚠️ Could not copy to clipboard automatically."));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment