HomeBlogSocial MediaMass unfollow People on Twitter that do not follow back

Mass unfollow People on Twitter that do not follow back

Welcome to the ultimate guide on mass unfollowing people on Twitter who do not follow you back! If you’ve been an active Twitter user for some time, you may have noticed that your follower count keeps increasing, but not everyone reciprocates your interest by following you back. This can lead to an imbalanced and cluttered timeline, making it difficult to keep up with the content that truly matters to you.

Fortunately, with this comprehensive guide, you’ll learn effective methods to streamline your Twitter experience by unfollowing non-reciprocal accounts in bulk. Whether you’re seeking a cleaner feed, aiming to build a more engaged network, or simply want to curate your Twitter presence, we’ve got you covered.

How to mass unfollow People on Twitter with Google Chrome

We will be using a simple way that Google Chrome does provide with the Developer console to input code into the website/execute code in Chrome to display it for you visually.

Go to your Following List to display people that you Follow:

  1. Open Twitter in your web browser and log in to your account.
  2. Once logged in, click on your profile picture or avatar located at the top right corner of the screen. This will open a dropdown menu.
  3. From the dropdown menu, click on the “Profile” option. This will take you to your Twitter profile page.
  4. On your profile page, you’ll see several tabs below your profile banner. Click on the “Following” tab.
  5. By clicking on the “Following” tab, you’ll be redirected to a page that displays the full list of accounts you follow on Twitter. It usually has the Domain https://twitter.com/YourUsername/following (YourUsername is the Username you have on Twitter)

Now you will have to open the Google Chrome Developer Console

  • On Windows/Linux: Ctrl + Shift + J
  • On macOS: Cmd + Option + J

(A detailed guide on how to open and use Developer Console for this can be found further below)

After you have done that input and execute the following Code (Copy and paste this script and click enter to run):

const SCRIPT_TIMEOUT = 20000; // Timeout in milliseconds (20 seconds)

let timerId; // Timer ID for tracking script timeout
let isPaused = false; // Flag to track script pause/resume

const startScriptTimeout = () => {
  clearTimeout(timerId);
  timerId = setTimeout(restartScript, SCRIPT_TIMEOUT);
};

const restartScript = () => {
  stopUnfollowing(); // Stop the current unfollowing process
  run({ unfollowNotFollowing: true, demo: false }); // Restart the script from the beginning
};

const handleScriptError = (error) => {
  // Handle script errors
  console.error(error);
  restartScript();
};

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

const tmuWrapper = document.createElement("div");
tmuWrapper.style.cssText = `
  position: fixed;
  right: 20px;
  bottom: 70px;
  z-index: 10;
  display: flex;
  visibility: hidden;`.trim();

const totalUnFollowed = document.createElement("h1");
totalUnFollowed.textContent = -1230;
totalUnFollowed.style.cssText = `
  background: #1da1f2;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  margin-right: 10px;
  font-size: 16px;
  width: 50px;
  height: 50px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  align-self: flex-end;
`;

tmuWrapper.appendChild(totalUnFollowed);

document.body.appendChild(tmuWrapper);

const showContentInDOM = () => {
  tmuWrapper.style.visibility = "visible";
};

const getFollowingsContainer = () => {
  return document.querySelector('section[role="region"] div');
};

const getFollowings = () =>
  Array.from(document.querySelectorAll('section[role="region"] [data-testid="UserCell"] [role="button"]'));

const getUsername = (followingBtn) => {
  return followingBtn.getAttribute("aria-label").toLowerCase().replace(/.*@/, "");
};

const filterFollowings = async (followings, unfollowNotFollowing) => {
  const whitelistedUsers = []; // Array of whitelisted users
  const unfollowedUsers = []; // Array of unfollowed users

  const toUnfollow = followings.filter((followingBtn) => {
    if (!whitelistedUsers.length) return true;
    const username = getUsername(followingBtn);
    return !whitelistedUsers.includes(username);
  });

  return unfollowNotFollowing
    ? toUnfollow.filter((following) => {
        const followsYou = following.parentElement.parentElement.querySelector('[data-testid="userFollowIndicator"]');

        if (!followsYou) {
          const username = getUsername(following);
          if (!unfollowedUsers.includes(username)) {
            unfollowedUsers.push(username);
            return true;
          }
        }
        return false;
      })
    : toUnfollow;
};

const confirmUnfollow = async () => {
  const confirmButton = document.querySelector("[data-testid=confirmationSheetDialog] div[role=button]");
  if (confirmButton) {
    confirmButton.click();
    await delay(1000);
  }
};

const unfollow = async (followingButtons = [], demo) => {
  for (const followingButton of followingButtons) {
    const username = getUsername(followingButton);
    totalUnFollowed.textContent = `-${username}`;
    if (followingButton.offsetParent !== null) { // Check if the user element is visible
      if (demo) {
        followingButton.firstElementChild.firstElementChild.firstElementChild.textContent = "Follow";
      } else {
        if (followingButton.getAttribute("data-tmu-hidden") !== "true") { // Check if the button is already hidden
          followingButton.setAttribute("data-tmu-hidden", "true"); // Set hidden attribute
          followingButton.click();
          await confirmUnfollow();
        }
      }
      await delay(200); // Reduce the delay to 200 milliseconds
    }
  }
};

let inProgress = false;
let previousScrollPosition = -1;
let hasScrolledToStart = false;
let scrollAttempts = 0;
const maxScrollAttempts = 5;

const scrollFollowingList = async ({ unfollowNotFollowing, demo } = {}) => {
  const followingsContainer = getFollowingsContainer();
  const scrollBy = followingsContainer.clientHeight;
  const followings = getFollowings();
  const accountsToUnfollow = await filterFollowings(followings, unfollowNotFollowing);
  if (accountsToUnfollow.length === 0) {
    if (!hasScrolledToStart) {
      // Scroll to the start of the list
      followingsContainer.scrollTo({ top: 0 });
      hasScrolledToStart = true;
    } else {
      // Scroll a bit further to check for more accounts
      followingsContainer.scrollBy(0, scrollBy);
    }
    await delay(3000);
    const currentScrollPosition = followingsContainer.scrollTop;
    if (currentScrollPosition > previousScrollPosition) {
      previousScrollPosition = currentScrollPosition;
      scrollAttempts++;
      if (scrollAttempts >= maxScrollAttempts) {
        stopUnfollowing();
      } else {
        await scrollFollowingList({ unfollowNotFollowing, demo });
      }
    } else {
      stopUnfollowing();
    }
    return;
  }
  await unfollow(accountsToUnfollow, demo);
  followingsContainer.scrollTo({ top: followingsContainer.offsetHeight + scrollBy, behavior: "smooth" });
  await delay(3000);
  const currentScrollPosition = followingsContainer.scrollTop;
  if (currentScrollPosition > previousScrollPosition) {
    previousScrollPosition = currentScrollPosition;
    scrollAttempts = 0;
    await scrollFollowingList({ unfollowNotFollowing, demo });
  } else {
    stopUnfollowing();
  }
};

const stopUnfollowing = () => {
  if (!inProgress) return;

  inProgress = false;

  tmuWrapper.style.visibility = "hidden";
};

const run = ({ unfollowNotFollowing, demo } = {}) => {
  if (inProgress) return;

  inProgress = true;
  showContentInDOM();
  scrollFollowingList({ unfollowNotFollowing, demo });

  startScriptTimeout(); // Start the script timeout timer
};

const handleBeforeUnload = (e) => {
  e.preventDefault();
  e.returnValue = ""; // Cancel the page reload prompt
};

const handleVisibilityChange = () => {
  if (document.visibilityState === "hidden") {
    isPaused = true;
    clearTimeout(timerId); // Clear the script timeout when the page is hidden
  } else {
    if (isPaused) {
      isPaused = false;
      startScriptTimeout(); // Resume the script timeout when the page becomes visible
    }
  }
};

run({ unfollowNotFollowing: true, demo: false });

window.addEventListener("beforeunload", handleBeforeUnload);
window.addEventListener("visibilitychange", handleVisibilityChange);
window.addEventListener("error", handleScriptError);

Configurable elements in the code:

  1. SCRIPT_TIMEOUT: This constant represents the timeout duration in milliseconds for the script. If the script execution exceeds this timeout, it will restart. You can modify this value according to your needs. For example, if you want to increase the timeout to 30 seconds, you can set it to 30000 (30,000 milliseconds).
  2. delay: This function is responsible for introducing a delay between actions in the script. The argument ms represents the duration of the delay in milliseconds. You can adjust this value to control the delay between actions. For faster execution, you can reduce the value, e.g., 100 for 100 milliseconds.
  3. unfollow: This function handles the unfollow action for each individual user. Within this function, there is a delay before each unfollow action. You can modify the delay duration using the delay function call within the loop. For example, if you want a delay of 200 milliseconds between unfollow actions, you can change await delay(500) to await delay(200).
  4. scrollFollowingList: This function controls the scrolling behavior when unfollowing users. It includes delays between scrolling actions and unfollowing actions. You can modify the delay durations within this function to control the speed of scrolling and unfollowing.
  5. handleBeforeUnload: This event handler prevents the page from reloading when the user tries to close or refresh it. It ensures that the script keeps running without interruption. If you want to change the timeout before the page reloads, you can modify the value of e.returnValue within this event handler.
  6. startScriptTimeout: This function starts the script timeout timer. If the script execution exceeds the specified timeout, it triggers the restartScript function. You can modify the timeout duration by changing the value of SCRIPT_TIMEOUT.

By adjusting these configurable elements, you can customize the timing, waiting periods, and timeout behavior of the script to better suit your requirements.

Feel free to modify these elements according to your needs and the specific performance you desire.

How to open the Google Chrome Developer Console?

Using the Keyboard Shortcut:

  1. Open Google Chrome on your computer.
  2. Navigate to the webpage you want to access the Developer Console for.
  3. Press the following keys simultaneously:
    • On Windows/Linux: Ctrl + Shift + J
    • On macOS: Cmd + Option + J
  4. The Developer Console window will open at the bottom or in a separate tab, depending on your Chrome settings.

Using the Menu Options:

  1. Open Google Chrome on your computer.
  2. Navigate to the webpage you want to access the Developer Console for.
  3. Click on the three vertical dots in the top-right corner of the browser window to open the Chrome menu.
  4. From the dropdown menu, hover over “More Tools.”
  5. In the expanded menu, click on “Developer Tools.”
  6. The Developer Console window will open at the bottom or in a separate tab, depending on your Chrome settings.

Now that you have the Developer Console open, you can input the code to automate the mass unfollowing process. Copy the code you have for unfollowing non-reciprocal accounts, and follow these steps:

  1. In the Developer Console window, locate the prompt that looks like a cursor (>) at the bottom.
  2. Click on the prompt to activate it, and it will allow you to input code.
  3. Paste the code you copied into the input field of the Developer Console.
  4. Press Enter to execute the code.

Once the code is executed, the mass unfollowing process will begin, and you’ll see the unfollow actions being performed in the background.

Why is it important to remove People that do not follow you back on Twitter ?

Maintaining a balanced follower-to-following ratio on Twitter is not just about aesthetics or popularity; it has a direct impact on your overall engagement and Twitter experience. Twitter’s algorithm takes various factors into account when determining the visibility of your tweets and the engagement they receive. One of these crucial factors is the follower-to-following ratio.

Having a significantly higher number of people you follow compared to your followers can negatively impact your engagement metrics. It can make it harder for your tweets to reach a wider audience, limiting the potential for meaningful interactions, retweets, and likes. On the other hand, a balanced follower-to-following ratio can enhance your visibility, increase the likelihood of followers seeing your content, and ultimately improve engagement on your tweets.

By mass unfollowing those who do not follow you back, you can bring your follower-to-following ratio into a more harmonious balance. This allows you to establish a more meaningful connection with your followers and build a community of engaged individuals who are genuinely interested in what you have to say. It helps you create a more focused and personalized Twitter experience, where you can connect with like-minded individuals, amplify your voice, and enhance the quality of your interactions.

In this guide, we’ll equip you with the knowledge and tools to effectively unfollow non-reciprocal accounts in bulk. By taking control of your following list and optimizing your follower-to-following ratio, you’ll be on your way to maximizing your engagement potential, cultivating a more valuable network, and enjoying a more rewarding Twitter journey.

Let’s get started and unlock the power of a balanced follower-to-following ratio on Twitter!

Why is our way of unfollowing people on Twitter advanced?

In addition to the importance of maintaining a balanced follower-to-following ratio on Twitter, we want to highlight that the method we’ll be discussing in this guide offers advanced benefits without requiring the use of Twitter’s API. Instead, we’ll be utilizing the Google Chrome Developer Console to automate the mass unfollowing process.

This approach eliminates the need for additional downloads or installations of third-party software. By leveraging the power of the Developer Console, we can interact directly with the Twitter website using JavaScript, making the process more accessible and user-friendly.

Furthermore, our code is designed to handle potential roadblocks and ensure a smooth experience. In case the process encounters any issues or interruptions, such as rate limits or unexpected errors, we have incorporated features that allow the code to automatically rerun after a short delay (typically between 20-30 seconds). This ensures that the mass unfollowing process continues seamlessly.

With our advanced method, you can confidently unfollow non-reciprocal accounts in bulk, saving time and effort while effectively managing your Twitter presence and maintaining a healthy follower-to-following ratio.

One of the advanced features of the Google Chrome Developer Console method we’ve discussed in this guide is its independence from your browser or account language. Unlike many other tools that rely on specific browser extensions or external software, our method operates directly within the website code itself.

This means that regardless of your browser or account language settings, you can leverage the power of the Developer Console to automate the unfollowing process on Twitter. Whether you’re using Chrome, Firefox, Safari, or any other modern browser, you can access the Developer Console and execute the provided code.

By interacting directly with the website code, our method ensures a higher level of compatibility and reliability. It reduces the chances of encountering issues related to language compatibility or specific browser requirements, providing a seamless experience for users across different platforms and setups.

So, whether you’re browsing Twitter in English, Spanish, French, or any other language, the Google Chrome Developer Console method remains a versatile and advanced approach that can be employed effectively.

Enjoy the flexibility and convenience of using this advanced method, and streamline your Twitter experience with confidence!
We hope that this guide on using the Google Chrome Developer Console to unfollow non-reciprocal accounts on Twitter has been helpful to you. Our aim is to provide you with the knowledge and tools to effectively manage your Twitter presence and create a more engaging experience

By utilizing the power of automation and the tips shared in this guide, we hope you have been able to streamline your follower list, maintain a balanced follower-to-following ratio, and enhance your Twitter interactions.

Disclaimer/Error Notice:

Please note that if you encounter any issues or if the code execution in the Developer Console doesn’t seem to be working as expected, there are a few troubleshooting steps you can try:

  1. Refresh the Page: Sometimes, refreshing the webpage can help resolve any temporary issues or conflicts that may be interfering with the code execution. Simply refresh the page and try again.
  2. Scroll Down: In certain cases, scrolling down just a little bit on the webpage before executing the code can ensure that all the necessary elements are loaded and accessible and people that do not follow you back can be found/seen. This can be especially helpful if you’re unfollowing users within a long list.
  3. Retry the Code: If the code execution gets stuck or encounters an error, you can try rerunning the code from the beginning. Copy the code again and repeat the steps to input and execute it in the Developer Console.

By following these troubleshooting steps, you can often overcome minor obstacles and continue with the mass unfollowing process smoothly.

However, please remember that any automated actions on Twitter, including mass unfollowing, should be performed responsibly and in accordance with Twitter’s terms of service. Be mindful of Twitter’s API usage limits and avoid excessive or abusive behavior that may violate their guidelines.

Now that you’re equipped with these tips, you can confidently navigate any potential challenges and proceed with mass unfollowing non-reciprocal accounts on Twitter. Best of luck!

Liability Statement:

The information, code, and instructions provided in this guide are intended for educational purposes only. We do not endorse or encourage any actions that go against Twitter’s Terms of Service or violate rate limits set by the platform.

While we have made efforts to ensure the accuracy and reliability of the information provided, we cannot guarantee its completeness or suitability for your specific circumstances. The use of any scripts or code discussed in this guide is entirely at your own risk.

It is important to note that Twitter’s Terms of Service and API usage policies are subject to change. We recommend reviewing and complying with the most up-to-date guidelines set by Twitter to avoid any potential consequences or account-related issues.

We assume no liability for any actions taken or consequences arising from the use of the information, code, or instructions provided in this guide. By using this guide and any associated code, you acknowledge and accept that you are solely responsible for your actions and the outcomes that may result from them.

We strongly advise using any automation techniques or scripts responsibly and within the limits set by Twitter. Respect the platform’s rules and guidelines to maintain a positive and compliant presence on Twitter.

Please exercise caution, use your best judgment, and prioritize the safety and integrity of your Twitter account while utilizing the information shared in this guide.

Leave a Reply

Your email address will not be published. Required fields are marked *

Beastfluence GmbH

Start your marketing & branding campaigns with Beastfluence and see what real experts in the industry can do for you.

©2024 Beastfluence GmbH. All Rights Reserved