A Utility That Makes You Master of the Twitterverse

You can do a lot more with Twitter than the official Web, mobile and desktop clients allow. To do it, though, you’ll need to access Twitter’s API — or use a tool that digs deeper into the API than the usual clients. If you’re comfortable with a command line interface, or willing to learn how to use one, t gives you simple, fine-grained control over your Twitter stream.

The one-letter Ruby gem, t, is written by Erik Michaels-Ober. The source is available on GitHub, or you can just grab it using Ruby’s gem install command. Ruby is on most *nix type systems by default (Linux distributions, Mac OS X) but Windows users will need to download the installer to get started.

After you’ve installed the t gem, you’ll need to authorize it. You can use it without getting API access, but then you’re limited to 150 requests per hour, and you can’t use t to post a Twitter message or make changes to your account.

Using t

To see all of the commands available via t, just run t help. You’ll find that t supports more than 40 commands, or tasks as its documentation calls them. The syntax is simple: t followed by the task name, and any options and arguments.

For example, you can use t to get all of the followers for an account by running t followers username. Note that you don’t need to include the @ in front of a username.

Many of the commands are mundane operations that you can do with any Twitter client. For example, posting a status update or following another user. Running t update "message goes here" will post an update, running t follow username will follow the user that you specify, and so on.

If you’re a command-line diehard, then you might prefer using t for those operations. But its real value is in doing things you can’t do with most Twitter clients. Want to see a list of users who follow you but whom you don’t follow? Run t groupies. You can also use that command to check on other users, t groupies username.

The most interesting thing about t is that it works well with other *nix commands. For example, you can create a list (t list create listname) and add all users who are followed by another user (t followings user | xargs t list add listname. That’s just a small sample. You can use any of the standard *nix utilities with t, like uniq, which might be useful in generating lists of users to follow by examining users that other people follow (and much more).

You may bump up against arbitrary limits when adding people to lists and such. According to the Twitter API docs, you can only add 100 users at a time to a list, and a list can only have 500 users. When I tested the limit, though, I was able to add 195 users to a list with one shot. The operation failed (sort of) when I tried to add another large chunk of users (more than 400), leaving my list with 582 members. To put it another way, trial and error is called for.

Some of the t commands also support a --csv option, which you can use to dump output to a comma-separated value file and then import it into a spreadsheet.

The Bad

While t has a lot to offer, it also has a few problems. First and foremost, a few commands don’t quite work. For instance, the t stream timeline command is supposed to provide an on-going stream of your timeline. It provides the first 20, and then errors out. The “matrix” command, likewise, returns an error. The “trends_locations” task doesn’t seem to be implemented at all, as it returns a “could not find task ‘trends_locations'” error.

The error messages, in general, are pretty minimal. You may be notified “too many terms specified in query” for instance – but no information on what part(s) of a command succeeded or failed. I’ve seen a few operations that appeared to mostly succeed, like adding users to a list, but received an error notice. When that happens, it’s not trivial to figure out what worked.

Sparse documentation is another problem. Many of the commands have options that are not well-explained. You may need to go spelunking through the code to see what options are available.

Finally, it’s pretty easy to hit Twitter’s rate limit. Twitter has an hourly limit of 350 requests per hour with an authenticated client. You can bump up against the limit if, for example, you try to request a list of all users for an account with tens or hundreds of thousands of followers. Note: If you wish to check on your current rate limit, use t rate_limit. You’ll see the current limit (should be 350) and how many remaining hits you have, and the time your limit will be reset.

For the most part, though, t works quite well and provides a great way to do more with Twitter than the usual clients allow. If you’re doing more than idle chit-chat on Twitter, take a look at t.

Facebook Comments