Created
June 26, 2022 16:06
-
-
Save DragoonAethis/3bf4da7e18258b81f6fe675e6a3691f5 to your computer and use it in GitHub Desktop.
On YouTube, open the transcription panel and run this bookmarklet to copy the transcription to your clipboard without timestamps.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (() => { | |
const fragments = []; | |
const elems = document.getElementsByClassName("ytd-transcript-segment-renderer"); | |
if (elems.length === 0) { | |
alert("No transcript elements found - are you sure the transcription panel is open?"); | |
return; | |
} | |
for (const elem of elems) { | |
/* Want timestamps? Remove .slice(1) here: */ | |
var frags = elem.innerText.split('\n').slice(1); | |
fragments.push(...frags); | |
} | |
navigator.clipboard.writeText(fragments.join('\n')).then( | |
function() {}, | |
function() { alert("Cannot access the clipboard - click anywhere on the page and try again."); } | |
); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create a new bookmark and set its URL to one of the javascript:... lines below. */ | |
/* No timestamps: */ | |
javascript:(() => {const fragments = [];const elems = document.getElementsByClassName("ytd-transcript-segment-renderer");if (elems.length === 0) {alert("No transcript elements found - are you sure the transcription panel is open?");return;}for (const elem of elems) {var frags = elem.innerText.split('\n').slice(1);fragments.push(...frags);}navigator.clipboard.writeText(fragments.join('\n')).then(function() {},function() { alert("Cannot access the clipboard - click anywhere on the page and try again."); });})(); | |
/* With timestamps: */ | |
javascript:(() => {const fragments = [];const elems = document.getElementsByClassName("ytd-transcript-segment-renderer");if (elems.length === 0) {alert("No transcript elements found - are you sure the transcription panel is open?");return;}for (const elem of elems) {var frags = elem.innerText.split('\n');fragments.push(...frags);}navigator.clipboard.writeText(fragments.join('\n')).then(function() {},function() { alert("Cannot access the clipboard - click anywhere on the page and try again."); });})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment