How to Mass Unfollow on Twitter

Have you ever wanted to remove some of your followers on twitter? Twitter does not provide a native way to do this, but you can automate it in your browsers developer console.

Steps:

  1. Using Chrome, login to your Twitter account and go to your follower’s page (https://twitter.com/following)
  2. Make sure you are using the Classic version of Twitter’s website.
  3. Open developer tools in your Chrome browser CMD+Option+C (Mac) or Control+Shift+C (Windows, Linux, Chrome OS)
  4. Go to the Console tab
  5. Paste in the code below and press enter
$('.unfollow-text').trigger('click')

This command will find all the unfollow buttons on the page and click them. So however many followers you have displayed will be immediately unfollowed.

 

I thought this was a neat trick to clean up your followers. Hope you find it useful.


Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LYWeather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.  

14 thoughts to “How to Mass Unfollow on Twitter”

  1. Tried it, but it doesn’t seem to work. Developer tools returns an error:

    VM93:1 Uncaught TypeError: Cannot read property ‘trigger’ of null
    at :1:20

      1. Hi Tim,

        I previously used this function. But it seems to be no longer working in the last month and am getting the same error as LCS. Not sure whether Twitter has changed something to stop it working?

        1. What browser are you using? Try Chrome browser. Also, this only works for the classic version of the twitter website.

  2. Same for me.

    “Uncaught TypeError: Cannot read property ‘trigger’ of null
    at ”

    Tried on my following page.

    1. What browser are you using? Try Chrome browser. Also, this only works for the classic version of the twitter website.

  3. After I put the code in you have above and I press enter, here is what I get – e.fn.init(21) [button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., button., prevObject: e.fn.init(1)]

    Then it doesn’t unfollow at all.

  4. Doesn’t work in Chrome or Classic gives this error VM105:1 Uncaught TypeError: Cannot read property ‘trigger’ of null
    at :1:20

    And yes I’m on the right page.

    1. Hey Dutton,

      In the past couple months, Twitter has updated their website which is most likely the reason this no longer works. It should still be possible with a few changes.

  5. This code worked for me, found it at this source
    https://gist.github.com/JamieMason/7580315

    // Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
    // https://gist.github.com/JamieMason/7580315
    //
    // 1. Go to https://twitter.com/YOUR_USER_NAME/following
    // 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
    // 3. Paste this into the Developer Console and run it
    (() => {
    const followButtonQuery = ‘[data-testid$=”-unfollow”]’;
    const confirmButtonQuery = ‘[data-testid=”confirmationSheetConfirm”]’;
    const sleep = ({ seconds }) =>
    new Promise(proceed => {
    console.log(`WAITING FOR ${seconds} SECONDS…`);
    setTimeout(proceed, seconds * 1000);
    });

    const nextBatch = async () => {
    window.scrollTo(0, document.body.scrollHeight);
    await sleep({ seconds: 1 });

    const followButtons = Array.from(document.querySelectorAll(followButtonQuery));
    const followButtonCount = followButtons.length;

    if (followButtonCount === 0) {
    console.log(`NO ACCOUNTS FOUND, SO I THINK WE’RE DONE`);
    console.log(`RELOAD PAGE AND RE-RUN SCRIPT IF ANY WERE MISSED`);
    return;
    }

    console.log(`UNFOLLOWING ${followButtonCount} USERS…`);

    await Promise.all(
    followButtons.map(async followButton => {
    followButton.click();
    await sleep({ seconds: 1 });
    const confirmButton = document.querySelector(confirmButtonQuery);
    confirmButton.click();
    })
    );

    await sleep({ seconds: 2 });
    nextBatch();
    };

    nextBatch();
    })();

Leave a Reply

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