Skip to content

Instantly share code, notes, and snippets.

@crashmax-dev
Created February 22, 2023 11:22
Show Gist options
  • Save crashmax-dev/7ade10e4c542218a2557b2435154bb5a to your computer and use it in GitHub Desktop.
Save crashmax-dev/7ade10e4c542218a2557b2435154bb5a to your computer and use it in GitHub Desktop.
let command = null
const observer = new MutationObserver(() => {
const player = document.querySelector('#ytd-player')
if (player && !command) {
command = player.player_
.getPlaylist()
.reduce(
(acc, videoId) => {
acc.push(`youtu.be/${videoId}`)
return acc
},
['!sr']
)
.join(' ')
console.log(command)
}
})
const yt = document.querySelector('ytd-app')
observer.observe(yt, {
attributes: true,
childList: true
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment