Last active
July 30, 2017 18:41
-
-
Save novotnyr/088b375e4461192829e27bf27665783e to your computer and use it in GitHub Desktop.
Downloads a lunch menu from KeltskaKrcma.sk and pipes it to the Slack webhook.
This file contains hidden or 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/sh | |
SLACK_HOOK=___FILL_IN____ | |
curl -s http://keltskakrcma.sk/index.php \ | |
| hxnormalize -x \ | |
| hxunent \ | |
| hxselect -i "#left_galeria table:nth-child(11)" \ | |
| hxnormalize -x -i 2 -l 99999 \ | |
| xmlstarlet sel -t -v "//tr[position() > 1]/td//text()" \ | |
| grep -ve '^\s*$' \ | |
| paste -d ' ' - - \ | |
| jq -R -s '{"attachments": [{"color": "#36a64f", "title": "Keltská krčma - denné menu", "title_link": "http://keltskakrcma.sk/index.php", "text": . } ] }' \ | |
| curl -X POST -H 'Content-type: application/json' --data @- https://hooks.slack.com/services/${SLACK_HOOK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requirements