2018-05-20 18:13:37 +00:00
|
|
|
#!/bin/bash
|
2018-08-20 14:42:42 +00:00
|
|
|
|
2018-11-10 20:05:50 +00:00
|
|
|
wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx -o /dev/null -O -|grep -v __REQUESTDIGEST|grep -v VIEWSTATE|hxnormalize -x -l 1000|hxselect .conteudo > mai-tmp
|
2023-08-08 13:05:55 +00:00
|
|
|
if [ $? -eq 4 ]; then
|
|
|
|
echo "mai: Network error. Site em baixo? Rede bloqueada?";
|
|
|
|
exit;
|
|
|
|
fi
|
|
|
|
|
2021-09-18 16:51:26 +00:00
|
|
|
cat mai-tmp|hxselect a -s'\n' > mai
|
2018-09-04 17:38:59 +00:00
|
|
|
if [ ! "$(diff mai scripts/14/mai|wc -l)" -eq "0" ]; then
|
|
|
|
echo "mai: incumprimento pode já não existir";
|
2023-04-13 15:42:18 +00:00
|
|
|
echo "DEBUG: mai-tmp:"
|
|
|
|
cat mai-tmp
|
|
|
|
echo "EOF"
|
2023-07-04 17:37:25 +00:00
|
|
|
echo "EXTRA DEBUG:"
|
2023-07-06 18:49:51 +00:00
|
|
|
# wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx && cat default.aspx && rm default.aspx
|
|
|
|
echo "wget's return code is:"
|
2023-08-02 11:56:13 +00:00
|
|
|
wget --no-check-certificate https://www.sg.mai.gov.pt/AdministracaoEleitoral/RecenseamentoEleitoral/ResultadosRecenseamento/Paginas/default.aspx ; echo $?
|
2018-05-20 18:13:37 +00:00
|
|
|
else
|
2018-09-04 17:38:59 +00:00
|
|
|
echo "mai: Incumprimento mantém-se, a actualizar o README (faça um git diff, valide, e commit!)";
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
test "$(echo "$line"|grep -c -v sg.mai)" -eq "1" \
|
|
|
|
&& echo "$line" \
|
|
|
|
|| (h=$(echo "$line"|cut -d\| -f1-4); t=$(echo "$line"|cut -d\| -f6-); echo "$h| $(date +%Y/%m/%d) |$t");
|
|
|
|
done < README.md > new
|
|
|
|
mv new README.md
|
2018-05-20 18:13:37 +00:00
|
|
|
fi
|
2023-04-13 15:42:18 +00:00
|
|
|
rm mai-tmp mai
|