Created
December 15, 2020 20:41
-
-
Save nickgs/7d7cba74d183a271159e1cadcec491cf to your computer and use it in GitHub Desktop.
Keep track of Best Buy console releases.
This file contains 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 | |
# use this with the `watch` command to keep an eye on the xbox page and when it becomes available. | |
#ex. watch -n 5 ./xbox_watcher.sh | |
#Xbox | |
#https://www.bestbuy.com/site/microsoft-xbox-series-x-1tb-console-black/6428324.p?skuId=6428324 | |
#Switch | |
#https://www.bestbuy.com/site/nintendo-switch-32gb-lite-yellow/6257142.p?skuId=6257142 | |
curl 'https://www.bestbuy.com/site/microsoft-xbox-series-x-1tb-console-black/6428324.p?skuId=6428324' \ | |
-H 'authority: www.bestbuy.com' \ | |
-H 'cache-control: max-age=0' \ | |
-H 'sec-ch-ua: "Chromium";v="86", "\"Not\\A;Brand";v="99", "Google Chrome";v="86"' \ | |
-H 'sec-ch-ua-mobile: ?0' \ | |
-H 'dnt: 1' \ | |
-H 'upgrade-insecure-requests: 1' \ | |
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' \ | |
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ | |
-H 'sec-fetch-site: same-origin' \ | |
-H 'sec-fetch-mode: navigate' \ | |
-H 'sec-fetch-user: ?1' \ | |
-H 'sec-fetch-dest: document' \ | |
-H 'accept-language: en-US,en;q=0.9' \ | |
-H 'cookie: oid=2030702125; UID=c22ef735-6804-4348-a49d-1a5dc00a01a2; campaign_date=1562771067265; campaign=212,1; partner=212%261%262019-07-10+10%3A09%3A12.471; optimizelyEndUserId=oeu1592620915931r0.15874485549753636; _abck=64AC4AD7DDF43C3A551C89D734559836~0~YAAQBwbSF1iAYJpyAQAA3LGazwQTNjxJJ4PtsxT5RYddUH68ecX7j+CwqQ38MqvcI8ahQn8InsCUughKAiP5qTTI3v3TS2as2bLLrHbo0WXl1IleESKI5MZk5rhZyVM2yadz9p0HTkil9+/6rKROUAA6v5aTQmSFrEB2zAGqLsdMU9vqbq8RogzIyd0Hm8p4DbHbfPNrfCh5EXtHVsr9sd5TtaA6Hstg2C0xIKNAb2klQmPO7nEyDmgAPaG6mP+pAY9TrvjV/0Lb9qfiP2Yk3JPVpB2r6lf1saSdVetoR4CSZMEEOzdK7tKlFoQ5VC21fnMQR0Jwmrm7e63OwZ6F~-1~-1~-1; AMCV_F6301253512D2BDB0A490D45%40AdobeOrg=1585540135%7CMCMID%7C08133820359630259278738884161751051044%7CMCAID%7CNONE%7CMCOPTOUT-1592628128s%7CNONE%7CvVersion%7C4.4.0; _cs_c=1; _cs_id=2d49cc3e-4b80-a504-9ca2-c12047f99062.1592620930.1.1592620930.1592620930.1.1626784930140.Lax.0; SID=fba71109-f72a-49a5-a39b-71b9d292341c; CTT=ced2dc84becbd52b2d26712abcb7eacc; rxVisitor=1608041682313FU1P19S3FD94OKGM0UU2LKGQ5TD6N1M4; bby_rdp=l; bm_sz=EA5A144956A2DEAEAA2D5789413B1B28~YAAQrxjfF3Kn4Xh1AQAAUtbAZgrro3OgM9u38zzhXdxcwKdREemXEcV37jebfpy0DKJnLRFhfKP05jDzbtZhkOuVQV5QXijuMIvgngE0oOLk3DMzvjgJkXTCVR/4uFBLEXVq0iN8Itb7QS8Oh3XI/4F2Kj55W0YYDYmVOI6dN2DAteuG796521eDB1yXSWOqdw==; COM_TEST_FIX=2020-12-15T14%3A14%3A43.017Z; dtCookie=v_4_srv_7_sn_USBG1NT9MDMR0MIF001AP2BM6SV04019_app-3A3ac06240f4cc0a9a_1_ol_0_perc_100000_mul_1; locDestZip=11730; locStoreId=442; sc-location-v2=%7B%22meta%22%3A%7B%22CreatedAt%22%3A%222020-12-15T14%3A15%3A30.229Z%22%2C%22ModifiedAt%22%3A%222020-12-15T14%3A15%3A30.430Z%22%2C%22ExpiresAt%22%3A%222021-12-15T14%3A15%3A30.430Z%22%7D%2C%22value%22%3A%22%7B%5C%22physical%5C%22%3A%7B%5C%22zipCode%5C%22%3A%5C%2211730%5C%22%2C%5C%22source%5C%22%3A%5C%22G%5C%22%2C%5C%22captureTime%5C%22%3A%5C%222020-12-15T14%3A15%3A30.223Z%5C%22%7D%2C%5C%22destination%5C%22%3A%7B%5C%22zipCode%5C%22%3A%5C%2211730%5C%22%7D%2C%5C%22store%5C%22%3A%7B%5C%22storeId%5C%22%3A442%2C%5C%22zipCode%5C%22%3A%5C%2211706%5C%22%2C%5C%22storeHydratedCaptureTime%5C%22%3A%5C%222020-12-15T14%3A15%3A30.429Z%5C%22%7D%7D%22%7D; pst2=442|N; physical_dma=501; customerZipCode=11751|N; vt=fce7a24a-3edf-11eb-a88f-12b5893245a3; dtSa=-; dtLatC=24; CTE22=T; basketTimestamp=1608041741893; dtPC=7$41737304_669h-vMMUCFKMQRLAKCBKAFMRSHURMJUVFLICB-0e2; rxvt=1608044041588|1608041682318' \ | |
--compressed > page.txt | |
# Disabled button | |
SEARCH="`cat page.txt | grep 'btn btn-disabled btn-lg btn-block add-to-cart-button'`" | |
# Active button | |
ASEARCH="`cat page.txt | grep 'btn btn-primary btn-lg btn-block btn-leading-ficon add-to-cart-button'`" | |
# Crowded search | |
CSEARCH="`cat page.txt | grep '<h1 class="sv-only">Sorry,<br>it’s crowded<br>in here!</h1>'`" | |
# See if we did not find a disabled button. | |
if [ -z "$SEARCH" ]; then | |
# Check for active button. | |
if [ -n "$ASEARCH" ] | |
then | |
echo "ALARM BELLS" | |
say "BUY BUY BUY" | |
fi | |
# See if site is just giving us their "busy" message. | |
if [ -n "$CSEARCH" ] | |
then | |
echo "CROWDED" | |
fi | |
else | |
# Inactive button found. | |
echo "Inactive"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment