Skip to content

Instantly share code, notes, and snippets.

@jameswang14
Created December 17, 2022 07:13
Show Gist options
  • Save jameswang14/1c6fcce91be6fe2ca1be4c92d2a39712 to your computer and use it in GitHub Desktop.
Save jameswang14/1c6fcce91be6fe2ca1be4c92d2a39712 to your computer and use it in GitHub Desktop.
let coupons = Array.from(document.querySelectorAll('button'))
.filter(el => el.textContent === 'Clip')
let lastCount = 0
while (coupons.length > lastCount) {
lastCount = coupons.length
// scroll to bottom and wait for coupons to load
window.scrollTo(0, document.body.scrollHeight);
await new Promise(r => setTimeout(r, 2000));
coupons = Array.from(document.querySelectorAll('button'))
.filter(el => el.textContent === 'Clip')
}
console.log("Done loading all coupons")
coupons.forEach((e, i) => setTimeout(() => {e.click()}, i*2000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment