@madpilot makes

You can’t do that on Twitter

Ok, I REALLY have to stop coming up with hare-brained ideas, and then listening to others when they convince me to implement them.

Spurred on my @cybner‘s new avatar, I thought it would be cool if you could slime people in Twitter if the say “I don’t know”.

So after a couple of hours of ruby hacking, I came up with: You can’t do that on twitter. Eveytime someone says the magic words, you should see their avatar get slimed! You can even try the public timeline or your own timeline (Click here and and change madpilot in the url to your username). Note though, that because this isn’t authenticated, your timeline will need to be public for it to work.

You can’t do that on Twitter

How it works

It is all very simple, using Ruby CGI, Mechanize and Hpricot. The steps are:

  1. Work out what page is requested (uses apache mod_rewrite for this)
  2. Build the twitter URL, and request it using Mechanize
  3. Parse the HTML using Hpricot
  4. Append a new JavaScript file, which inserts the slime image based on an inserted class name
  5. Iterate through the tweets, grepping for the term “I don’t know”. If it finds it, it inserts the “slime” class
  6. On window.load, the inserted JavaScript file finds all images with that class and dynamically inserts the slime.png image above it. Using the twitter prototype instance, it gets placed over the avatar image.

I started off using Mechanize, then realised I didn’t really need it, but left it in there as it does do the HTTP request thing quite well. Download the source. Enjoy!

Update: Some good old You can’t do that on television sliming:

4 comments

  1. I have a couple of reports that it doesn't work for all people. I don't know why, and I'm not going to investigate. Sorry if you fall in to this category. Maybe try another browser - it works on Firefox and IE7 on Windows, Safari on Windows - not so much.



    YMMV
  2. Oh dear. Now I'll be thinking of Twitter as one extended locker sketch.



    After all, what's @username if it's not "Hey Moose..."
  3. Simply damn awesome!
  4. Wierd, but impressive.



    I don't think I've ever seen "I don't know" on Twitter, but if you could make it configurable I'd add these phrases to my slime list:



    ZOMG

    teh

    interwebs

Leave a comment