About 4 years ago we introduced TBUZZ, a Web browser add-on which makes it super-easy and super-fast to tweet about any web page and to see what people are saying on Twitter about that page. We were big fans of the tool and enjoyed using it ourselves, and it developed a small but passionate group of users out there in the world.
Unfortunately, after a few years Twitter changed their API and TBUZZ stopped working. Many of us here at Arc missed it and we heard from some vocal fans as well, but we were busy and just didn’t have the time to look into updating it. We mourned its passing and learned to live with slow tweeting and manual searching. We never forgot it, though. It would inevitably come up over drinks at one of our happy hours or over tacos at weekly lunch, or in ideas in our Kindling instance.
Today I’m excited to say that we have updated TBUZZ and it’s now 100% functional! We eventually found a little time to scratch this particular itch, and we’re very happy with how it’s come out. If you’d like to check it out, just head over to tbuzz.arc90.com!
For those of you interested in the sausage-making, here’s a quick recap of what it took to resurrect TBUZZ:
All interactions with the Twitter API are handled by the TBUZZ server, which was written in PHP and used a hodgepodge of various OAuth and Twitter libraries which targeted Twitter’s no-longer-in-service 1.0 API.
At first I tried to update the server by replacing the various OAuth and Twitter libraries with the Zend Framework’s OAuth and Twitter services, which have been updated to work with Twitter’s current API. The server already used an older version of the framework, so this seemed like it should be a simple matter of upgrading the framework, then rewiring the code to use it. Unfortunately this didn’t go well. I simply couldn’t get Twitter authentication working properly, and the Zend Framework’s OAuth service proved too difficult to debug.
After being stymied by PHP and the Zend Framework for a few hours too many, I scrapped the entire server codebase and rewrote it in Python using Flask, Flask-OAuth, and Python Twitter Tools. This took only a few hours, and the resulting codebase was a breath of fresh air. To illustrate, the app went from 22 PHP files containing 996 lines of code to 1 Python file containing 92 lines. (To be fair, TBUZZ today doesn’t need to work as hard as it used to, since Twitter now uses its own URL shortener and its search engine dereferences shortened URLs.)
Working with Flask and Flask-OAuth was a joy — until I found that one of the decorators in Flask-OAuth may raise an exception in certain cases, and there’s no way to catch exceptions raised in a decorator when the decorator is applied in the usual way using
@-syntax. A bug report was created for this 2 years ago, so I wasn’t going to hold my breath waiting for it to be fixed. I ended up having to apply the decorator manually, which is not easy — thanks to Chris Schomaker for helping out with that! We concluded that functions and methods which are intended to be used as decorators should not raise exceptions; rather, they should call the wrapped function and pass the exception as an argument, à la Node callbacks.
Once we had all the features working properly, we realized that we couldn’t relaunch TBUZZ with its dated look-and-feel — it deserved better. So Robert Petro stepped up and redesigned the app and its installation page, making both feel thoroughly sleek and modern.
Thanks for reading, and I hope you enjoy TBUZZ!