UPDATED: Twittering Without a Client App

26 Comments

twitter

Many of us are hip to Twitter these days, and there are a myriad of options for keeping track of the resulting tweets. I personally bounce between the webpage itself and Tweetdeck (while on my Mac). But sometimes I want to trim down my open windows to the bare minimum. Here’s one way to keep up with your Twittering, without having any windows open.

Twitter w/o Windows

Twitter w/o Windows

You’ll need Geek Tool to monitor incoming tweets. (Geek Tool is a free utility that runs as a Preference Pane and lets you embed shell output, URLs, and more in your desktop.) I set up a new Shell Command entry, with the following command (all on one line):

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e 's// /' | sed 's// /' | sed 's/ //'

This command uses the shell command curl to pull the RSS update feed of those you follow. Be sure to substitute username:password with your own Twitter credentials. The sed commands mainly perform a find and replace to clean up the output, removing html title tags and leading spaces. If you’re looking for more information on the curl and sed commands, pop open your Terminal.app (/Applications/Utilities), and type man curl or man sed for the manual of usages for each. Geek Tool offers other customizations like font and positioning on screen so play until you find your sweet spot.

Using either Quicksilver or Google’s Quick Search Box (Quicksilver’s new sibling), will allow you to post tweets easily without a client app front and center. With either, you can quickly invoke the input window, type your 140 characters, and send it off to Twitter — and like that, the interface vanishes until you need it again. Using Quicksilver requires that you download an Applescript which gives you a ‘Tweet’ action, and then modify a Keychain setting for your Twitter login credentials — the latter can be a bit messy for a novice. Quick Search Box is much easier in comparison, only asking you to add your Twitter account details in one of the preference windows. Once you’ve setup Quicksilver or Quick Search Box, invoke the interface, type your Tweet, and send it off. Easy peezy, lemon squeezy.

This setup may not be useful for everyone, but it is nice when you want minimal interference while you work. I’m quickly finding this interface to be my preferred mode of interaction with Twitter.The GeekTool/Quick Search Box (or Quicksilver) combo do nicely to sit in the background until you’re ready, and then fade back out as soon as you’re through with them.

Update

Two TAB readers were kind enough to provide some modified code that are a bit cleaner than what I posted and are tweaked a bit to their liking.

Scott: “Here is the updated code that I’m using, which only uses one sed invocation so avoiding another process spawn (the head and tail are obviously because I only want the most recent 14 entries and don’t want the top line):”

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep "<title>" | sed -E 's/^[ ] //; s/<title>(. )</title>/1/' | head -n 15 | tail -n 14

Matt: curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e 's/<title>/ /' | sed -e 's/</title>/ /'

26 Comments

Sam

Oh and if your wondering Thats just my name and DOB. Some people seemed to get the whole username and password this wrong.

Justin

Hi there,

I’m a scripting newbie trying to get twitter on my desktop via geektool.

I was able to use one the scripts posted above (thank you). However, the formatting is a little dense.

Is there a way to add a space between each twitter entry?

Any help or input is greatly appreciated.

Sam

Well i just fell for the newbie error of blogs, damn html. so on the first “title”, wrap it with less-than and greater-than signs, on the second one wrap with the slash “/title”.

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | perl -nle ‘print for m:title(.*)/title:’ | head -n 6 | tail -n 5

Sam

Just found this blog as i was looking for the same thing. Anyway i was playing round with the scripts here and there and managed to produce a script that woks perfectly:

curl -s -u username:password
http://twitter.com/statuses/friends_timeline.rss | perl -nle ‘print for m:(.*):’ | head -n 6 | tail -n 5

With this code it will only show your top 5 tweets

Tips.

Twitter only allows you to call this information on your IP address 100 times an hour. So if have been trying to get it to work and have been failing try setting the Refresh in Geektool to a larger number

hum

@Nick – maybe just link to a screenshot of what the code should look like? I tried entering the fixes per your posts #13 and #14 and I still can’t get them to work. (Well, actually, Matt’s code worked for 10 minutes or so, but then disappeared :/ …)

Nick Santilli

wow, now I’m really getting frustrated with this too…
basically, anyplace you see title, wrap it with less-than and greater-than signs, because they should be html title tags. the closing title tag /title actually looks like / because of the bash syntax. so when you see the /title, include both of those slashes when you wrap it in the less-than and greater-than signs.
[sigh] the formatting really made me screw the pooch on this one. Sorry folks.

Mine (a bit rudimentary)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ‘s/title/ /’ | sed ‘s//title/ /’ | sed ‘s/ //’

Scott’s (With some added customization)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep “title” | sed -E ‘s/^[ ]+//; s/title(.+)/title/1/’ | head -n 15 | tail -n 14

Matt’s
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ‘s/title/ /’ | sed -e ‘s//title/ /’

Nick Santilli

@Mitch – snark away :)
Actually, they do work, but the ‘code’ display is being tripped up because we’re trying to reference html tags.

we’re trying to update the update to read properly… In the meantime just know that anywhere you see or , you should remove the _. Sorry for the confusion. so here are the 3 commands:

Mine (a bit rudimentary)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ‘s// /’ | sed ‘s// /’ | sed ‘s/ //’

Scott’s (With some added customization)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep “” | sed -E ‘s/^[ ]+//; s/(.+)/1/’ | head -n 15 | tail -n 14

Matt’s
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ‘s// /’ | sed -e ‘s// /’

Hope that helps, and again, sorry for the confusion

Mitch

I don’t want to sound narky, but is anyone actually *testing* the code? Seriously, none of these work for me.

Nick Santilli

Matt – nick DOT appleblog AT gmail me the code snippet you’re trying for and I’ll get the post updated to reflect the better way

thx

Nick Santilli

Scott and Matt: Thanks for the cleaner commands. I haven’t been eyeballs deep in bash in several years, and even then I wasn’t extremely savvy. So the command I posted above was a rough slap-together job that was workable for my needs.

And Matt, yes, the leading TAB was the culprit. Of course using negative alignment in Geek Tool is another way to handle that for those preferring not to mess with sed any more than necessary…

Matt Rodkey

Oh well, I give up the comment system does not allow for the HTML tags to show up.

Matt Rodkey

one more try with code tags.

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | | grep title | sed -e 's// /' | sed 's// /'

Matt Rodkey

ah, I can see the problem now has I read my own comment the site removed the following from between the opening // in each of the seds

(adding spaces between chars to hopefully prevent removal)
1)
2)

Matt Rodkey

this modification of the original works for me:
| grep title | sed -e ‘s// /’ | sed ‘s// /’

The part up to the URL remains the same. I am not sure what the 3rd sed call was supposed to be removing, perhaps the leading TAB.

Scott

Hahaha…of course, it stripped out everything useful. In the grep and the sed I’m now missing my ‘title’ tag captures.

Soli

Why piping three seds ? One invocation with three ‘-e’ should work.
Moreover your regexps didn’t make it properly to the HTML (I guess, especially if you wanted to remove the and part).

Comments are closed.