Automating StreamYard's past broadcasts deletion

StreamYard doesn't have a delete all past broadcasts button.

So I coded this script real quick to automate the job.

(async function () {
while (true) {
    let menu_buttons = document.querySelectorAll('#dashboard-broadcasts-content-past > div > table > tbody > tr > td > div > span > button');
    if (menu_buttons.length === 0) break;
    menu_buttons[0].click();
    await new Promise(resolve => setTimeout(resolve, 1000));
    document.querySelector('div[id^="broadcast-row-menu"] > div > ul > li > button').click()
    await new Promise(resolve => setTimeout(resolve, 1000));
    document.querySelector('div > form > div > button[color="error"]').click();
    await new Promise(resolve => setTimeout(resolve, 4000));
}
})()