Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save udaragangabadage/b224e5205bc42284f21a2900f905c3be to your computer and use it in GitHub Desktop.
Save udaragangabadage/b224e5205bc42284f21a2900f905c3be to your computer and use it in GitHub Desktop.
Automate Unfollow/Follow
Check files inside this gist
let btns = document.querySelectorAll("[data-testid]")
let followBtns = Array.from(btns).filter(btn => {
return btn.getAttribute('data-testid').includes('follow')
})
for (let i = 1; i <= followBtns.length; i++) {
setTimeout(() => {
followBtns[i - 1].click()
}, 1000 * i);
}
let btns = document.querySelectorAll("[data-testid]")
let unfollowBtns = Array.from(btns).filter(btn => {
return btn.getAttribute('data-testid').includes('unfollow')
})
for (let i = 1; i <= unfollowBtns.length; i++) {
setTimeout(() => {
unfollowBtns[i-1].click()
setTimeout(() => {
document.querySelector("[data-testid='confirmationSheetConfirm']").click()
}, 500);
}, 1000 * i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment