Skip to content

Instantly share code, notes, and snippets.

@bmiro
Created December 21, 2017 20:16
Show Gist options
  • Save bmiro/9baba6f5c116c34d7b2518b249067bae to your computer and use it in GitHub Desktop.
Save bmiro/9baba6f5c116c34d7b2518b249067bae to your computer and use it in GitHub Desktop.
#!/bin/bash
url="https://resultats.parlament2017.cat/09AU/DAU09999CM.htm"
last=""
while true
do
hour=$(curl -s "$url?$RANDOM" | \
grep '="hora"> .* <\/span>' | \
sed 's#.*=\"hora\"> \(.*\) </span></span>.*#\1#' | \
sed 's/ h /:/')
perc=$(curl -s "$url?$RANDOM" | \
grep xescrutado | \
awk -F'Counted' '{ print $2 }' | \
awk -F'span' '{ print $3 }' | \
sed 's#[<>/]##g')
if [ "$last" != "$perc" ]
then
last="$perc"
echo "$hour $perc"
beep
fi
sleep 30s
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment