Last active
January 9, 2022 08:19
-
-
Save far1dghaderi/7554789afba3a3bd3a562e6fdd76d90c to your computer and use it in GitHub Desktop.
Get instagram's followers list
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
let prevFollowers = localStorage | |
.getItem(`${location.pathname.split("/")[1]}-followers`); | |
let followers = document.querySelectorAll("._1XyCr .FPmhX"); | |
let flwrs = []; | |
followers.forEach((item) => { | |
flwrs.push(`${item.href}`.split("/").reverse()[1]); | |
}); | |
if (prevFollowers) { | |
prevFollowers = prevFollowers.split("-"); | |
let newFollowers = flwrs.filter((follower) => { | |
return !prevFollowers.includes(follower); | |
}); | |
console.log({ | |
count: `${newFollowers.length} new people followed my crush`, | |
newFollowers, | |
}); | |
let unfollowed = prevFollowers.filter((follower) => { | |
return !flwrs.includes(follower); | |
}); | |
console.log({ | |
count: `${unfollowed.length} new people unfollowed my crush`, | |
unfollowed, | |
}); | |
} else { | |
console.log( | |
"no previous followers detected! we gave you a report next time you run this script" | |
); | |
} | |
localStorage.setItem( | |
`${location.pathname.split("/")[1]}-followers`, | |
flwrs.join("-") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment