Created
June 21, 2025 01:07
-
-
Save TheSethRose/e35afb11080c67dfa1f1ab906f38f413 to your computer and use it in GitHub Desktop.
Follow Verified (Twitter) π Followers Back
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
| /** | |
| * Warning: Use this code at your own risk. This code automates the process of following all verified followers. | |
| * Please make sure to review the platform rules regarding automated scripts and proceed at your own discretion. | |
| * | |
| * This Function is designed to automate the process of following all verified followers. | |
| * It does so by loading all followers, hiding the already followed users and then following the remaining users sequentially with a delay between each action to mimic human behavior. | |
| * It relies on specific elements and their attributes to operate; if the source layout or characteristics change, the function may not operate as expected. | |
| */ | |
| async function followAllVerifiedFollowers() { | |
| /** | |
| * Generates a random delay between a min and max value. | |
| * @param {number} min - The minimum delay in milliseconds. | |
| * @param {number} max - The maximum delay in milliseconds. | |
| * @returns {number} A random number between min and max. | |
| */ | |
| const getRandomDelay = (min, max) => Math.floor(Math.random() * (max - min + 1) + min); | |
| /** | |
| * Scrolls to the bottom of the page, waiting a random amount of time between scrolls. | |
| */ | |
| const scrollToBottom = async () => { | |
| let previousHeight; | |
| while (true) { | |
| previousHeight = document.body.scrollHeight; | |
| window.scrollTo(0, document.body.scrollHeight); | |
| const delay = getRandomDelay(1500, 2500); | |
| console.log(`Scrolled. Waiting for ${delay}ms for new users to load...`); | |
| await new Promise(resolve => setTimeout(resolve, delay)); | |
| if (document.body.scrollHeight === previousHeight) { | |
| break; | |
| } | |
| } | |
| }; | |
| /** | |
| * Finds and hides all user cells where the "Following" button is present. | |
| */ | |
| const hideFollowedUsers = () => { | |
| const userCells = document.querySelectorAll('[data-testid="UserCell"]'); | |
| let hiddenCount = 0; | |
| userCells.forEach(cell => { | |
| const followingButton = cell.querySelector('[data-testid$="-unfollow"]'); | |
| if (followingButton) { | |
| cell.style.display = 'none'; | |
| hiddenCount++; | |
| } | |
| }); | |
| console.log(`Hid ${hiddenCount} users that you already follow.`); | |
| }; | |
| /** | |
| * Clicks all visible "Follow back" buttons with a random delay between each click. | |
| */ | |
| const followBackUsers = async () => { | |
| const followButtons = document.querySelectorAll('[data-testid$="-follow"]'); | |
| const buttonsToClick = Array.from(followButtons).filter(btn => btn.offsetParent !== null); | |
| console.log(`Found ${buttonsToClick.length} users to follow back.`); | |
| for (let i = 0; i < buttonsToClick.length; i++) { | |
| const button = buttonsToClick[i]; | |
| button.click(); | |
| console.log(`Followed user ${i + 1} of ${buttonsToClick.length}.`); | |
| const delay = getRandomDelay(700, 1800); | |
| console.log(`Waiting ${delay}ms...`); | |
| await new Promise(resolve => setTimeout(resolve, delay)); | |
| } | |
| }; | |
| console.log("Starting script: Scrolling to the bottom to load all followers..."); | |
| await scrollToBottom(); | |
| console.log("β Finished scrolling."); | |
| // Currently doesn't work, but im too lazy to debug, since the | |
| // rest of the code works properly. π€·ββοΈ | |
| console.log("Hiding users you already follow..."); | |
| hideFollowedUsers(); | |
| console.log("β Finished hiding users."); | |
| console.log("Starting to follow back remaining users..."); | |
| await followBackUsers(); | |
| console.log("β All done! All visible verified followers have been followed back."); | |
| } | |
| followAllVerifiedFollowers(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment