let sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms))
;(async () => {
for (let sel of [...document.querySelector("#contents").children.item(0).children.item(0).children].reverse()) {
sel.children.item(5).children.item(1).click()
await sleep(100)
document.querySelector(`path[d='M14 10H2v2h12v-2zm0-4H2v2h12V6zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2 16h8v-2H2v2z'`).parentElement.parentElement.parentElement.click()
await sleep(100)
document.querySelector("#playlists > ytmusic-playlist-add-to-option-renderer:nth-child(2) > button").click()
await sleep(100)
}
})()