Last active
March 29, 2021 22:50
-
-
Save brandonmp/d2182fcc1eaedc25538fabe566c36377 to your computer and use it in GitHub Desktop.
unroll me, bro
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
/* When run in the Chrome console, this function clicks all of the 'unsubscribe' buttons | |
* on the 'Edit Subscriptions' screen of https://unroll.me/a/subscriptions/new */ | |
const unsubs = [...document.querySelectorAll('.btn.btn--link')].filter( | |
// collect all the buttons on the page | |
b => b.textContent === 'Unsubscribe' | |
); // filter down to just the Unsubscribe buttons | |
// this function will pause after each click for 750ms to respect their servers | |
const sleep = () => new Promise(resolve => setTimeout(resolve, 750)); | |
const doUnsubs = async () => { | |
let i = 0; // keep track of progress | |
for (let btn of unsubs) { | |
// ...for each unsub button | |
if (btn) btn.click(); // ..click it.. | |
await sleep(); // ...then pause | |
console.log(`Btn #${i} clicked`); // .. and print the progress | |
i += 1; | |
} | |
}; | |
doUnsubs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment