Skip to content

Instantly share code, notes, and snippets.

@dan-maximov
Created July 26, 2020 16:16
Show Gist options
  • Save dan-maximov/efbc1a3de061e67852f38da9050d161f to your computer and use it in GitHub Desktop.
Save dan-maximov/efbc1a3de061e67852f38da9050d161f to your computer and use it in GitHub Desktop.
Add all songs to bookmarks from BSaber songs list
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