Created
November 26, 2020 22:48
-
-
Save cblte/9e8358a8dfcee42ba53ddfcea924e27f to your computer and use it in GitHub Desktop.
Check for new MacBook Pro on coolblue and mediamarkt
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 | |
urlcb="https://www.coolblue.nl/en/laptops/apple-macbook/apple-macbook-pro/13-inch-screen/processor:apple-m1-chip" | |
urlmm="https://www.mediamarkt.nl/nl/category/_apple-mac-755619.html?searchParams=%2FSearch.ff%3FfilterTabbedCategory%3Donlineshop%26filterCategoriesROOT%3DComputer%25C2%25A7MediaNLnlc482710%26filterCategoriesROOT%252FComputer%25C2%25A7MediaNLnlc482710%3DApple%2BMac%25C2%25A7MediaNLnlc755619%26filteravailability%3D1%26filterProcessormodel%3DApple%2BM1%26channel%3Dmmnlnl%26followSearch%3D9954%26disableTabbedCategory%3Dtrue%26navigation%3Dtrue&sort=&view=&page=" | |
text1=$'NEW MAC NEW MAC! Check the Website!\n\n' | |
countcb=`curl -s -L $urlcb | grep -c -E -i "alt=\"Apple .* MYD.{3}\/"` | |
countmm=`curl -s -L $urlmm | grep -c -E "name\":\"APPLE MacBook Pro.*M1"` | |
sendmail=false | |
if [ "$countcb" != 4 ] | |
then | |
mailbodycb=$text$'Check Out CoolBlue Website \n'$urlcb$'\n' | |
sendmail='true' | |
fi | |
if [ "$countmm" != 4 ] | |
then | |
mailbodymm=$text$'Check Out MediaMarkt Webseite \n'$urlmm$'\n' | |
sendmail=true | |
fi | |
if [ "$sendmail" = true ]; then | |
mailbody=$mailbodycb $mailbodymm | |
echo $mailbody | mail -s "UPDATE" $EMAIL | |
exit 0 | |
fi | |
echo "Nothing changed, no updates. Just delete me" | mail -s "DELETE ME - Nothing happend. Sorry" $EMAIL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment