Skip to content

Instantly share code, notes, and snippets.

@fritschy
Last active March 11, 2020 09:29
Show Gist options
  • Save fritschy/54147448b89711d8d3f5cf001776cb80 to your computer and use it in GitHub Desktop.
Save fritschy/54147448b89711d8d3f5cf001776cb80 to your computer and use it in GitHub Desktop.
Unsave/Unlike reddit posts JS snippet
// Paste to firefox js console
// Source: https://stackoverflow.com/a/59443772
// XXX unsave posts
const delay = ms => new Promise(res => setTimeout(res, ms));
(async () => {
for (const a of document.querySelectorAll('.link-unsave-button > a, .comment-unsave-button > a')) {
a.click();
await delay(300);
}
console.log('done');
})();
// XXX unlike posts
const delay = ms => new Promise(res => setTimeout(res, ms));
(async () => {
for (const a of document.querySelectorAll('div.arrow.upmod.login-required.access-required')) {
a.click();
await delay(100);
}
console.log('done');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment