Use Yahoo! Pipes to get your Twitter feed in shape

January 31, 2009

A few people follow my tweets through the RSS feed provided by Twitter (or through RSS-->email), but Twitter won't let me choose whether I want @replies to show up in the feed. I don't want them there, and neither do my followers (especially when they don't know the people I'm messaging). (This is the same issue that prompted me to modify the Twitter Tools WordPress plugin.)

Another thing I don't like about the RSS feed provided by Twitter is that the title and description elements have the same content — the tweet — and so each tweet shows up twice in feed readers, which is kind of annoying. Further, Twitter insists on prefacing each tweet with your username, which also is annoying.

Fortunately, these niggles can be taken care of rather painlessly by routing the feed through Yahoo! Pipes; the image below shows the source of the pipe I use to do just that.

Yahoo! Pipe for Twitter RSS feed

The filter operator searches for, and removes, all items whose description element contains "username: @" (i.e., the structure of every @reply given the username preamble).

The regex operator does a couple of things. First, it removes "username: " from every title, and so only the tweet remains. Second, it removes the description element from every item; "." matches any non-newline character, and "*" matches zero or more copies of the preceding character set (in our case, any non-newline character). Because the regex operator acts on the entire element, including the element's type, ".*" wipes out the entire line.

You should follow me on Twitter here