Skip to content

Instantly share code, notes, and snippets.

@segyges
Created October 2, 2025 15:21
Show Gist options
  • Select an option

  • Save segyges/74778bf0ca29a1172d396ac4d9004a05 to your computer and use it in GitHub Desktop.

Select an option

Save segyges/74778bf0ca29a1172d396ac4d9004a05 to your computer and use it in GitHub Desktop.
// Takes a youtube transcript and makes it one big string
// Get all transcript segments
const segments = document.querySelectorAll('ytd-transcript-segment-renderer');
// Extract text from each segment
const text = Array.from(segments)
.map(segment => segment.querySelector('.segment-text')?.textContent.trim())
.filter(text => text) // Remove any empty entries
.join(' ');
console.log(text);
// Optionally copy to clipboard
copy(text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment