2008年4月17日木曜日

Twitter public_timeline たれ流し (sh)



#!/bin/sh

while true ;do
curl -s --compressed http://twitter.com/statuses/public_timeline.xml | \
(
echo -n ^[c
echo "----------------------------------------------------------------"
echo "Twitter public_timeline -- `date`"
echo "----------------------------------------------------------------"
xmlstarlet sel -t -m //text -o "* " -v ../user/screen_name -o " (" \
-v ../user/name -o "@" \
-v ../user/location -o ") -- https://twitter.com/" \
-v ../user/screen_name -n -v . -n -n -
)
echo -n "reload after 30 sec: "
for ((i=1;i<=30;i++)) ;do
echo -n "^H^H`printf '%02d' $i`"
sleep 1
done
done

## should change the strings below by hand
## ^[c -> Ctrl + v ESC c
## ^H -> Ctrl + v Ctrl + h