Introducing Twitter Followers Checker
Ever so often my Twitter followers list changes and usually that means that somebody stopped following me. Leaving aside their reasons (if you ask me, I wouldn't follow me in the first place) I hate the fact that Twitter doesn't provide a way of informing me who was it. Instead, I have to remember. And since I have the worst memory anyone could possibly have, I decided to do something about it (about Twitter's lack of functionality, not my memory).
UPDATE: Due to this being a pet project, twitter changing its API and my limited free time, this application no longer exists. Thank you all who have found this tool useful.
OK, I'll admit it, my memory isn't the only reason I started this. After all, there's Qwitter, a site that emails you when somebody stops following you. And probably a dozen other similar solutions out there. My main reason for making this is having a chance to finally poke the Twitter API and play around (once again) with jQuery. Yet another reason would be to avoid doing my practicals, but I doubt I would be doing them anyway.
So, without any further ado, I introduce you to the Twitter Follower Checker (name says it all?). This little application took me about a day and still needs a lot of work to actually be any useful, but it quickly tells you what you want to know: Who started/stopped following you.
How does it work? Well, how would you keep track of your followers list changes? Probably the first thing that will come to your mind is to store somewhere (text file?) all your current followers list. Then, when you notice that your followers count has changed you simply compare the old stored list with the new current list.
Well, that is exactly what this does! As you can see, it's magic! You enter the users screen name (yes, it can be any user, as long as he is not private), upload the old data and click "Check!" to compare the two! Voila! You quickly find out your recent changes and get filled with unattractive numbers.
As in most cases though, no matter how simple an application sounds, there are always some creepy little bugs that can't wait to jump in front of you and make your life miserable for a couple of hours at least.
One of those bugs was found while using the jQuery Form Plugin. It took me more than an hour to finally find out that a simple change of a string was all it took. See, when you use jQuery Form Plugin with files, you must not have an input with the name attribute set to "submit". That's fine. I changed that and my problem still remained. So I thought that the problem was somewhere else. A couple of hours later I accidentally saw in the Firefox Error Console that "jquery form plugin form.submit is not a function". So I go back to my input field and change the id="submit" to something else and that was it! Or was it? Unfortunately, it was. I wish it was something more sophisticated.
However, the biggest "bug" I have is displaying Twitter screen names. I say "bug" (with quotation marks) and not bug (without quotation marks) because it seems like one to the end-user but it's actually a limitation of the Twitter API (and my time). The problem is fetching the followers list in a human readable way. If you want to fetch a users followers list, Twitter API gives you two options:
- statuses/followers will return the 100 latest updated followers with full information (name, screen name, location, description etc.)
- followers/ids will return a list of all the followers User IDs (instead of screen names)
In the first case, there are two problems: speed and amount. It is dead slow, in contrast with the second case, because you have to download so much information, which is mostly useless, and at the same time it's limited to only the last 100 followers.
In the second case there is an even bigger problem. followers/ids provides you with a list of all the followers a user has, but the list contains User IDs instead of usernames. Which would be perfectly fine if translating a User ID to a username wouldn't cost you anything. Unfortunately that is not the case. One of the ways of translating is by using users/show, which costs one hit for every query. If you have more than 100 followers, it's almost impossible.
The end result of this is that, instead of displaying perfectly readable user names, the end-user sees a bunch of linked numbers. Every click on a link costs him 1 hit and takes him to an unreadable xml file.
Of course there are many ways to solve these problems: Caching names, translating the xml etc. But then it wouldn't be my one-night-stand application. They all need time, which I have, but prefer spending it on my next one.
On the bright side, I had some fun with the Twitter API. I loved and hated it's simplicity. Loved it because it was easy to actually use the API and hated it because the documentation was seriously limited (i.e. you cannot find the 100 followers limitation of the statuses/followers in it's documentation page).
Funny story: while trying random usernames, I found that sdfsdfasd actually is a registered user! Looking closer you will see that he is not that active as one might think. Digging even deeper you find out that the only person he is following (MITcpw) has many users just like him. Interesting! But boring. Anyway.
One final note. Every time I catch myself using jQuery, I can't resist not overusing it. I keep thinking "can I make this without refreshing the site?". So when the time came to add the "powered by jQuery" button I said to myself "this doesn't represent me at all". So I went and quickly fixed a button that perfectly describes my jQuery usage.
And there you have it, my latest over-jqueried web app that's probably totally useless. Knock yourselves out!
Note to self: start using images in my posts!