Last active
July 20, 2020 16:59
-
-
Save szepeviktor/252591058a0f9a1163cbfb07216b8a1d to your computer and use it in GitHub Desktop.
Marseus.hu HP WorkStation figyelő
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 | |
EXPECTED_HASH=1c9f2c2b7e9879a5a5cda6cb550710f55b3caa48 | |
Get_product_titles() | |
{ | |
# Download page, fix ampersands, convert to XML, parse product titles | |
wget -qO- https://www.marseus.hu/hu/szamitogep/workstation/hp/ \ | |
| sed -e 's/&\([a-z_]\+\=\)/\&\1/g' \ | |
| xmlstarlet fo --html --recover 2>/dev/null \ | |
| xmlstarlet sel --template --value-of '//div[@class="product_list "]//h2/a' | |
} | |
CURRENT_TITLES="$(Get_product_titles)" | |
CURRENT_HASH="$(echo "${CURRENT_TITLES}" | shasum | cut -d " " -f 1)" | |
if [ "${EXPECTED_HASH}" == "${CURRENT_HASH}" ]; then | |
exit 0 | |
fi | |
echo "HP Workstation érkezett. (${CURRENT_HASH}) | |
https://www.marseus.hu/hu/szamitogep/workstation/hp/ | |
${CURRENT_TITLES}" 1>&2 | |
exit 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment