Last active
August 2, 2020 11:53
-
-
Save itsazzad/06cef57b30ee313b492ce5aeb3ac7df1 to your computer and use it in GitHub Desktop.
Instagram Mass Unfollow
This file contains hidden or 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
const DELAY = 1000; | |
const delay = ms => new Promise(res => setTimeout(res, ms)); | |
const list = document.querySelectorAll("body > div.RnEpo.Yx5HN div.isgrP > ul li"); | |
for (const sub of list) { | |
try { | |
sub.querySelector("div.Igw0E.rBNOH.YBx95.ybXk5._4EzTm.soMvl > button").click(); | |
} catch (err) { | |
console.error(err) | |
sub.querySelector("div.Pkbci > button").click(); | |
} | |
await delay(DELAY); | |
const toUnfollow = document.querySelector("body > div:last-child div._08v79").innerText.trim(); | |
if (toUnfollow.startsWith('Unfollow @')) { | |
document.querySelector("body > div:last-child div.mt3GC > button.aOOlW.-Cab_").click(); | |
console.log("Unfollowing", toUnfollow); | |
} else { | |
document.querySelector("body > div:last-child div.mt3GC > button.aOOlW.HoLwm").click(); | |
console.log("Skipped", toUnfollow); | |
} | |
await delay(DELAY); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment