The script wasn't working for me.  I had to modify line 21 like this:
	Code:
	Channel=`echo $ChannelUrl | awk -F "/" '{print $4}' | sed 's/#//g'`
 it's to get rid of the "#" character in the channelurl when it goes to fetch the XML file to get all the needed data.  I guess not all the channel URLs have the "#" in them, if they do then you need to get rid of it.
BTW, thanks very much for this solution.  I just saw 
another page about Justin.tv but it was a completely manual solution.  Yours is much slicker!