In Honor of the Current WootOff: Bag of Crap Alarm Version 0.02
Wednesday, 23 September 2009
Ever since woot changed their design, my script has been broken. Since we have a wootoff going on now, I've refined and updated it so that once more it works.
I've removed a feature in the public version that runs your browser of choice with the buy now link in order to quash the competition, and so that you can learn a little bit if you desire this feature...add it yourself! It's just one line of code.
To use this, you need a UNIX style shellscript interpreter, sed, grep, curl, and play, though you could use any equivalent program for these to mod the script to work on other OS'es than Mac and Linux.
Download by clicking here, and see the below for the code, should you want to look it over.
#Wootwatch Alarm v0.02
#Written by Matt Parnell/ilikenwf http://www.mattparnell.com
#This is totally free, take it and mod it however you wish, under the GNU GPLv3.
#This script goes every 3 sec to woot and checks for a bag of crap. If found, it sounds an alarm.
while [ $i -lt "1" ]
r=`expr $r + 1`
WOOT=`curl -s -f http://www.woot.com`
ITEM=`echo $WOOT | /bin/sed 's/.*<h2 class="fn"[^>]*>\([^>]*\)<\/h2>.*/\1/'`
BUY=`echo $WOOT | grep -o WantOne.aspx?id=.[[:alnum:]]*-[[:alnum:]]*-[[:alnum:]]*-[[:alnum:]]*-[[:alnum:]]*`
if echo $ITEM | grep "Random\ Crap"; then
play -q alarm.mp3 &
echo "BOC FOUND after $r runs."
AVAIL=`echo $WOOT | grep -o "width:[[:alnum:]]*\%'><" | grep -o "[[:alnum:]]*\%"`
echo "Current item: "
echo "Price: $`echo $WOOT | /bin/sed 's/.*<span class="amount"[^>]*>\([^>]*\)<\/span>.*/\1/'`"
if echo $AVAIL |grep [[:alnum:]] > /dev/null; then
echo "Available: $AVAIL"
echo "SOLD OUT"
echo "This script has run $r Times."
sleep 1 && clear