Skip to content

Instantly share code, notes, and snippets.

@LasseWolter
LasseWolter / fetch-yt-captions.js
Last active September 4, 2024 18:25
Simple js script to fetch the auto-generated youtube captions for the video currently open in your browser window
function decodeUnicodeEscapeSequence(str) {
return str
.replace(/\\u/g, "%u")
.replace(/(%u)([a-fA-F\d]{4})/gi, function(_, _, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
}
function parseXML(xmlStr) {
// Create a new DOMParser object