Unfollowing a couple of thousand people on Twitter
Posted on 2014-02-10, 14 comments, 126 +1's, imported from Google+/Chainfire

NOTICE: This content was originally posted to Google+, then imported here. Some formatting may be lost, links may be dead, and images may be missing.

A few days ago, something strange happened. I opened up Twitter and found I was suddenly following a couple of thousand people. Though at first I thought they were random people, it ended up being people who all followed me as well (by choice).

I don't know how or why it happened. Checked my apps with access, didn't see anything suspicious (only a few very well known and common services), still disabled all of them. Changed passwords, etc. It's interesting to note that since I did all that, I'm already following new people I never chose to follow ...

Either way, as interesting as no doubt all of my followers really are, it made Twitter's home feed unusable, and thus I decided I needed to unfollow the new additions to my feed.

Quite likely there are other tools out there that can do the job, I simply didn't check. Some have asked me exactly how I did it, so here's the recipe.

I have Firefox installed with Firebug, which lets you execute whatever JavaScript you want on the loaded page. After I logged in to Twitter, I went to the list of people I'm following, and held the PageDown button until all of them were loaded. I then scrolled back up to find the last person I actually wanted to follow.

Then I opened up the Firebug console, tapped the bottom-right arrow button (Show command editor) to open up the multi-line command box, and input the script you can find here: https://gist.github.com/Chainfire/8918813 . Twitter already uses jQuery so I didn't have to load that in.

At the top you will find two variables, delay and until . delay is the time between the script clicking Unfollow buttons. If this is too quick, Firefox will crash after a number of requests. It may still do that regardless of this value though. I had 4 crashes before I unfollowed in total about 2000 people. The until variable is the last person I chose to follow (the @name, with case as displayed in their profile, without the @ itself), the script abandons when it runs into that name. The person you followed last is at the top of the list and the person you followed first at the bottom, so that works.

So there it is, worked for me, YMMV.


Chainfire/twitter_unfollow.js

+1126
Kilian von Pflugk commented on 2014-02-10 at 16:57:

google chrome works too

Kilian von Pflugk commented on 2014-02-10 at 17:12:

and works for following top https://twitter.com/who_to_follow/suggestions 80~ per min

Andrew Dodd commented on 2014-02-10 at 17:14:

I'm glad for two things:

1)  Twitter shows who you're following in the order of when you followed, most recent first

2)  When this happened to me, I had far fewer people added to my followers list.  I wish I could have somehow mass-reported them for paying for a "gain more followers" service that was compromising accounts somehow.

(my Twitter account was compromised a few weeks ago.  Did they turn you into a Russian car salesman too +Chainfire ?)

Kilian von Pflugk commented on 2014-02-10 at 17:17:

stupid twitter hacker

Vaibhav Bhasin commented on 2014-02-10 at 17:19:

That's the Chainfire way! :D

Joe Philipps commented on 2014-02-10 at 17:21:

I don't suppose so, but is there anything we can do to get these providers (Twitter, Google+, probably lots of others) not to do this silly, silly thing of not loading the entire page? I despise these pages which insert more into the page upon some sort of "I've scrolled the page" event.  I don't even mind so much if you give me some of the page (so that I don't wonder if it worked at all), and use JS to fill in the rest of the page, just don't wait until I scroll.  I don't know quite enough about events (yet) to write userscript to look for the "More" at the bottom of a Google+ page and continually generate a click on it (calling the click() method on the object doesn't always work on some pages, you'd have to instantiate new events of mousedown and mouseup on them instead) until "More" no longer shows up.  (Translation: I'm not quite pissed off enough to do it (yet).)  Heck...I notice it also doesn't always work all the time to let the PgDown key autorepeat.

OK...sorry.  I feel a little bit better having sounded off on that.

Thomas Tallant commented on 2014-02-10 at 17:36:

Google+ seems to handle it well; scroll to the bottom, then it loads the next group automatically.  I'm fine with that.  Just don't make me click "load more" or some other silliness.  

Thomas Tallant commented on 2014-02-10 at 17:38:

Although, an option to "load "X" number of posts" would be nice when you're trying to find an old article.

Joe Philipps commented on 2014-02-10 at 17:38:

+Björn Petersen , maybe you have thousands of posts to load at once, but I don't. I have at most say 70...and that's if I haven't visited in a couple of days. When I'm done reading a post and its comments, I mute it; I don't want it showing up in my Stream anymore.

Joe Philipps commented on 2014-02-10 at 17:47:

+Björn Petersen , ummmm...yes? when I'm done with them. I don't want Google to decide when I'm done with a post and let it "fall off the end," I want to control that. Also, from your comment, it seems you misunderstood. I never said you couldn't interact with the page until it was totally complete, I said load something in the page, then load the rest with JavaScript...much like is done now, except don't wait for the event of trying to scroll, or clicking "More."

The reason is fairly simple...trying to find something with the browser's search function isn't nearly as useful if one does not have all the data.  I also would rather see things in (at least roughly) chronological order, not reverse chronological order.

Joseph Gonzales commented on 2014-02-10 at 18:35:

+Chainfire but if you unfollow me how will you know when I'm taking a shit or re-tweeting to win a contest.

A Jaber commented on 2014-02-10 at 20:47:

i was wounder if you readed my tweet suddenly you followed me ... i thougt you saw it .. :3

Jon Shipman commented on 2014-02-11 at 00:47:

Did the same thing in Harvest for selecting tasks for a new project, but in raw js

(function() {

var ts = document.getElementById('tasks-select');



for (var i=0;i<ts.options.length;i++) {

    ts.options[i].selected=false;



    if (i != (ts.options.length-1)) {

        ts.options[i].selected=true;

        var evt = document.createEvent('MouseEvents');

        evt.initEvent('click', true, false);

        document.getElementById('create-task-assigment-link').dispatchEvent(evt);

    }

}

})();

Sai Shivankar commented on 2014-02-11 at 08:19:

Pure genius.....I am a huge fan of your apps and have convinced 25-30 people in my street to buy Triangle away!

This post is over a month old, commenting has been disabled.