Likewise, for similar that outputs a JSON.
This will never run on a Gaia host until R&D updates xmllint to version 20913 (even on R81.20, xmllint is 20904 which doesn't have --xpath). Regardless, this is good for anything where you're doing automation or some other monitoring. I tweaked this from someone else's original design (acknowledgement given, too).
[det@signet ~]$ cat check_jhf.sh
#!/bin/bash
# Fetch Check Point HFA details
# Original design by Hugo van der Kooij
CURL="curl -s -k -o -"
BASE="https://sc1.checkpoint.com/documents/Jumbo_HFA"
for VER in R80.20 R80.30 R80.40 R81.10 R81.20
do
if [ $VER = "R81" ]; then
VER2="R81.00"
else
VER2=$VER
fi
TAKE_URL="$BASE/$VER/$VER2/"
#echo " *** Version $VER ***"
$CURL "${BASE}/${VER}/${VER2}/${VER2}-List-of-all-Resolved-Issues.htm" | \
xmllint --html --xpath 'concat(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[(contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/text()," '"`printf '%s %s' Ongoing ${TAKE_URL}`"'", string(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[(contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/@href),"
", //table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[not (contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/text(), " Recommended '`echo $BASE/$VER/$VER2/`'", string(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[not (contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/@href),"
")' - 2>/dev/null |\
sed -e 's/^.*Take //g' -e 's/ - / /g' -e 's/Ongoing Ongoing/ Ongoing/g' -e 's/ Ongoing/ Ongoing/' -e 's/General Availability[ ]*//g' |\
jq --arg version $VER -R '.|split(" ") as $jhf |
if ($jhf[0]|length == 0) then
empty
else
{ "version" : $version, "take" : $jhf[0], "status" : $jhf[1], "url" : $jhf[2] }
end'
done |jq -s '{ jhf_list : .|sort_by(.version,.take) }'