February 24, 2011
Find Twitter RSS feeds for individual users

RSS feeds for individual Twitter users are impossible to find if you are using “New Twitter.”1

Fortunately the format is very simple:

http://twitter.com/statuses/user_timeline/[id].rss

where [id] is your Twitter ID number.

So all we need to do is find the ID number associated with the name. Even better, because Twitter does not require authentication for accessing user timelines (at least as of 2011-02-24), it is possible to do this with curl or lynx and without needing your Twitter login.

The following bash script will take several twitter usernames (without the @!) and return the RSS feed for each one.

If you get a blank feed, either Twitter crapped out or the user was not found (check for typos).

#!/bin/bash

PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/X11R6/bin:/root/bin

for TWIT in $*
do

FEED=`curl -s "http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=$TWIT" |\
egrep '^    <id>'   |\
head -1             |\
sed 's#^    <id>#http://twitter.com/statuses/user_timeline/#g; s#</id>#.rss#g'`

echo "$TWIT: $FEED"

done

The ‘curl’ line simply downloads the information.

‘egrep’ tells it to look for an <id> tag a specific number of characters from the left margin

‘head -1’ tells it to look for the first match (if the user geotags information, those will also appear in a similar <id> and each also gets an <id> with a different left margin.

‘sed’ tells it to replace <id> with the first part of the URL and replace the </id> with ‘.rss’

The output should look something like this if you checked for ‘tjluoma’:

tjluoma: http://twitter.com/statuses/user_timeline/13022392.rss

note that the username is shown at the front of the URL for identification since the script allows you to enter several usernames at once.

Why would you want an RSS feed of someone on Twitter?

I want this because some people post so infrequently that I don’t want to miss it. Some people ‘misuse’ Twitter as an RSS feed, but in some instances that’s actually helpful when an RSS feed is not otherwise available.

My concern is that since Twitter is already making this access difficult to find, they will soon be making it impossible to use.

Why not just use the RSS feed that my browser shows me in my URL/Address Bar?

That is a feed to your favorites, not to the specific user’s posts.

Download

You can download the script here from Dropbox.


  1. “New Twitter” is the name given to the revised user interface to Twitter.com. It’s a drastic change, and overall I think it’s a positive one with a lot of good new features. You can see the old format here 

  1. luoma posted this
blog comments powered by Disqus