

This probably has happened to you: you say something on Twitter and 5 minutes later some unknown person is following you. That new follower's principal subject is related to a word that you dropped in one of your previous twits. This happened to me with 'failwhale' and 'twhisky'.
This gave me the idea to build the same thing for a blog I write on. I wanted bxlblog's twitter account to automatically follow everyone that was saying 'bruxelles', 'brussels' or 'brussel', hoping that the person I'd have subscribed to would return the favor and become a reader of the cityblog bxlblog.
How can you achieve such a thing? It actually is quite simple: by sending a simple HTTP-request to the Twitter-search, containing the keywords you are looking for. Then you parse the result to extract user names and send another request to Twitter to just follow them. That's it! It's better for you to put that in crontab, every 5 minutes or so.
To run my script you need two things: first of all, a Linux-machine where you have shell-access in administrator mode (I use Ubuntu). Then you also have to install the curl-package that will send the follow-requests using POST and basic authentication :
sudo apt-get install curl
After that, open an editor for the script:
nano /home/emich/twittersearch.sh
And paste the following script and save/exit :
#!/bin/bash
/usr/bin/wget -O /home/emich/twittersearchresult http://search.twitter.com/search?q=bruxelles+OR+brussels+OR+brussel
NAMES=`/bin/cat /home/emich/twittersearchresult`
for value in $NAMES
do
if [[ $value =~ home\?status\=@([^\"]*)\" ]];then
i=1
n=${#BASH_REMATCH[*]}
while [[ $i -lt $n ]]
do
/usr/bin/curl --basic --user twitteruser:twitterpassword --data status="follow ${BASH_REMATCH[$i]}" http://twitter.com/statuses/update.xml
let i++
done
shift
fi
done
Now we need to change permission, in order to be able to execute that script :
chmod +x /home/emich/twittersearch.sh
Finally, add it to your crontab :
crontab -e
Let's say, every 5 minutes :
*/5 * * * * /home/emich/twittersearch.sh
This script can easily be written in other languages. Just don't abuse.