By bblfish on Apr 29, 2009
Here are the short steps to do this:
- I wrote a Scala Program (see source) to take the twitter Atom feed, and generate xhtml from it.
- I wrote a shell script to run the compiled scala jar
#!/bin/bash export CP=$HOME/java/scala/lib/scala-library.jar:$HOME/java/scala/lib/learning.jar /usr/bin/java -cp $CP learning.BlogIFrame $\*
- Then I just started a cron job on my unix server to process the script every half an hour
$ crontab -l 5,36 \* \* \* \* $HOME/bin/twitter.sh $HOME/htdocs/tmp/blogs.sun.com/tweets.html
- Finally I added the iFrame to my blog here pointing to the produced html
<IFRAME src="http://bblfish.net/tmp/blogs.sun.com/tweets.html" height="300" frameborder="0"></IFRAME>
As a result there is a lot less load on the twitter server - it only has to serve one atom feed every half an hour instead of 1000 or so a day - and my html blog page does not stall if the twitter site itself is overloaded.
Also I learnt a lot about Scala by doing this little exercise.