Created
July 26, 2020 16:16
-
-
Save dan-maximov/efbc1a3de061e67852f38da9050d161f to your computer and use it in GitHub Desktop.
Add all songs to bookmarks from BSaber songs list
This file contains 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
function addAllSongsOfPageToBookmarks() { | |
const queue = Array.from(document.querySelectorAll('[data-type="add_bookmark"]')); | |
let i = 0; | |
const intervalId = setInterval(() => { | |
if (!queue.length) { | |
clearInterval(intervalId); | |
console.log(`there's no songs to add to bookmark from this page`); | |
return; | |
}; | |
const e = queue.pop(); | |
e.click(); | |
i++; | |
console.log(`added ${i} songs, ${queue.length} songs left to add`); | |
if (!queue.length) { | |
clearInterval(intervalId); | |
console.log(`${i} songs from this page have been added to bookmarks`); | |
return; | |
}; | |
},1250); | |
}; | |
addAllSongsOfPageToBookmarks(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment