Skip to content

Instantly share code, notes, and snippets.

// To test this, copy and past into the dev console of Google Chorme.
// credit:
// https://gist.github.com/geuis/8b1b2ea57d7f9a9ae22f80d4fbf5b97f#gistcomment-3436392
(async () => {
html = await fetch(window.location.href).then(resp => resp.text()).then(text => text);
startStr = 'ytplayer.config = {';
start = html.indexOf(startStr) + startStr.length - 1;
end = html.indexOf('};', start) + 1;
playerObj = JSON.parse(html.slice(start, end));