stormbot/triggers/link/link.sh

12 lines
315 B
Bash
Raw Normal View History

2016-09-04 17:22:05 -04:00
[ -f functions.sh ] && source functions.sh
2016-09-04 19:15:51 -04:00
curl="$(command -v curl)"
2016-09-04 17:22:05 -04:00
for l in $3 ; do
if [[ "$l" =~ http://|https://|www\.* ]]; then
2016-09-04 19:15:51 -04:00
pageTitle="$($curl -Ls "${l/#:/}" | grep "<title>" | html2text | tr '[:space:]' ' ')"
2016-09-04 17:22:05 -04:00
shortLink="${l#*://}"
shortLink="${shortLink%%/*}"
msg "$2" "$pageTitle at $shortLink"
fi
done