Created
February 22, 2023 11:22
-
-
Save crashmax-dev/7ade10e4c542218a2557b2435154bb5a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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