Forked from abrahamvegh/iPad2-White-WiFi-Target-Availability.sh
Created
April 22, 2011 06:20
-
-
Save jcsalterego/936158 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
############################################################ | |
# BEGIN CONFIG | |
# | |
ZIP_CODE=90210 | |
TIMEOUT=600 # seconds | |
# END CONFIG | |
############################################################ | |
dpci="057-10-1830" # ipad 2 wifi black 16gb | |
url='http://sites.target.com/site/en/spot/mobile_fiats_results.jsp?_DARGS=/site/en/spot/mobile_fiats.jsp' | |
magic="_dyncharset=ISO-8859-1&asin=&dpci=${dpci}&zipcode=${ZIP_CODE}&city=&state=" | |
results="./ipad2-black.results" | |
while true; do | |
clear; | |
date; | |
echo -n "iPad 2 Wi-Fi Black 16GB: "; | |
# This magic courtesy of Garrett Murray: http://log.maniacalrage.net/post/4030658171/tip-how-to-get-an-ipad-2-at-target-today-i | |
# Thanks Garrett! I have barely an idea of how this works, but it is truly brilliant! :) | |
curl -s --data "$magic" \ | |
"$url" \ | |
| grep -A 2 strong \ | |
| sed -e 's/<[^>]*>//g' \ | |
> "$results"; | |
if [ -z "$(grep Avail $results)" ]; then | |
echo "nada." | |
say "Nada"; | |
else | |
echo "bingo!"; | |
grep 'Avail' -B2 "$results"; | |
while true; do | |
echo -n "Bingo! " | |
say "Bingo"; | |
sleep 60; | |
done; | |
fi | |
echo "Trying again in $timeout seconds." | |
sleep $timeout; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment