-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchecker.sh
executable file
·36 lines (29 loc) · 1.19 KB
/
checker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# ps5 digital edition
amazondig='B08H97NYGP'
# ps5 standard edition
amazonstd='B08H95Y452'
check_amazon() {
versions=$*
regions="co.uk de"
for version in $versions; do
for region in $regions; do
if [ "$version" == "$amazondig" ]; then
model='Digital Edition'
else
model='Standard Edition'
fi
status=$(curl -s https://www.amazon."$region"/dp/"$version" -H 'User-Agent: Mozilla/5.0 (Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0' \
| grep -i "div id=\"availability\"" -A 10 | sed -n '7 p')
if [[ $status != "Currently unavailable." && $status != "Derzeit nicht verfügbar." ]]; then
echo "Go get your PS5 here: https://www.amazon.$region/dp/$version" \
| mail -s "PS5 is in stock!" [email protected]
echo "$(TZ="Europe/Stockholm" date):Amazon ""$region"":""$model"":AVAILABLE!!!" >> /opt/ps5.log
else
echo "$(TZ="Europe/Stockholm" date):Amazon ""$region"":""$model"":""$status""" >> /opt/ps5.log
fi
sleep 10
done
done
}
check_amazon "$amazondig $amazonstd"