Created
April 2, 2025 03:44
-
-
Save nhtua/dd14aee7d24e0eb7c30d4dcddf8eb93a to your computer and use it in GitHub Desktop.
Script to clean up your Instagram following accounts (so your wife won't kill you!!)
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
// Following these steps to clean up your Instagram profile, just in case it has followed thoudsand of accounts. Now you don't want anybody knows that, so clean it up. | |
// 1. Open your profiles account | |
// 2. Click on Following button (link) to open the pop-up pane. Keep scroll down to list all the following account. | |
// 2. Press F12 | |
// 3. Copy and past the code bellow into console. Enter. | |
// 4. Keep the window open for few hours, or days in some cases to finish the job. Don't try to speed up as Instagram has rate limit on unfollow requests; | |
function findElementsByInnerText(textToFind, tagName) { | |
const elements = document.getElementsByTagName(tagName); // Get all elements of the specified tag | |
const matchingElements = []; // Initialize an empty list to store matching elements | |
for (let i = 0; i < elements.length; i++) { | |
if (elements[i].innerText === textToFind) { | |
matchingElements.push(elements[i]); // Add the element to the list if innerText matches | |
} | |
} | |
return matchingElements; // Return the list of all matching elements (could be empty if no matches) | |
} | |
function myClick(ele, delay, doSomething) { | |
setTimeout(()=>{ | |
ele.click() | |
setTimeout(doSomething, 200) | |
}, delay) | |
} | |
ll = findElementsByInnerText('Following','button') | |
for(let i = 0; i<ll.length; i++) { | |
myClick(ll[i], i*25000, ()=>{ | |
unfollowBtn = findElementsByInnerText('Unfollow','button') | |
unfollowBtn[0].click() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment