Using Yahoo pipes to remove the usernames from twitter RSS feeds

So, the other day I decided I wanted a twitter feed on the homepage of this site. There are various ways I could have done this. There are various drupal modules around for twitter integration, (but none have a stable D7 implementation yet) or I could have knocked something up client-side using Javascript/jQuery and the twitter API, but I was in a bit of a rush and I wanted something super quick. I also wondered how well drupal could do this using just core/basic modules.

The instant idea I had was to suck the twitter RSS feed for my profile into the Drupal aggregator module. The aggregator module was already in drupal core and it would give me a pre-defined block, plus I could use the views module to sort and filter exactly what I want.

First step was to add the twitter RSS url for my profile into the aggregator. New twitter makes this somewhat difficult to find, as the only RSS feed in the page <head> tag, and hence shown in the browser address bar is for your twitter favourites. Some digging in the help and switching quickly to old twitter found what I wanted. For info, the urls are at:

So far, so good. A quick cron run and my feed was populated and showing on the home page. Problem is, twitter prepends both the title and body fields of their RSS feed with the username of the person tweeting. You can see why you'd need this for a hashtag feed, or a list or something, so presumably they've just got one template for everything. For a feed from one user's profile, its a bit annoying as the same name is repeated over and again, which looks wierd and uses up layout space.

Twitter feed screenshot

Aside from writing some PHP to parse this and remove the username in a module (too slow) or theme (must avoid hardcoding in themes!), there didn't seem to be any way to get around this straight away in drupal. However a quick google later and I remembered Yahoo Pipes, an awesome service I discovered a while back. For those that haven't seen this service before, yahoo pipes essentially lets you take in feeds from various sources and perform all sorts of sorting, combining and formatting on them.

A quick search discovered a pipe by Stefan Grund doing this already (don't you just love the internet?):

Unfortunately, Stefan's Regular expression was cutting out all text before the last colon in the tweet. This works great if you have only plain text in your tweet, but since most nowadays include a URL of some sort, it was also trimming out everything up to the colon in So a little adjustment of the RegEx and everything is working fine. This is what the resultant feed from the pipe looks like:

Yahoo pipes screenshot without usernames

I made two versions, one which you can copy and edit the hardcoded twitter profile URL, and one which takes the profile ID as a text input value. Here's the links in case you want to copy and use these yourself:

Twitter RSS feed without username (hardcoded ID):

Twitter RSS feed without username (user ID input box)