#!/bin/bash -e # vim: set ts=4 sw=4 # apache_setenv('no-gzip', '1'); # TODO re-implement in PHP exec 2>&1 cat <Bad input, parameter id $@" exit } oldpwd=$PWD saveIFS=$IFS IFS='=&' parm=($QUERY_STRING) IFS=$saveIFS if test ${parm[0]} == "id" then id=$(echo ${parm[1]} | tr -dc '[:alnum:]_' | tr '[:upper:]' '[:lower:]') test ${#id} -gt 0 || badinput is empty test ${#id} -lt 20 || badinput is too large else exit fi if test "${parm[2]}" == "o" # unused then test "${parm[3]}" && old=1 fi cat < Fetching tweets of $id
END if test -d u/$id then echo "

Attempting to update $id

" else # TODO: This API is deprecated! if curl -sI http://api.twitter.com/1/users/lookup.xml?screen_name=${id} | grep -q "Status: 404 Not Found" then echo "

$id does not exist on twitter.com :(

" exit fi mkdir -p u/$id fi cd u/$id ln -sf ../../index.html || true ln -sf ../../grep.php || true if echo $id | grep -q -v '_' # Underscores in domain names is a no no then cat <

Goto http://$id.greptweet.com to grep!

END else cat <

Goto http://$HTTP_HOST/u/$id to grep!

END fi ln -sf $id.txt tweets.txt test -h greptweet.appcache && rm -f greptweet.appcache sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache echo "
"

../../fetch-tweets.sh $id & disown