stormbot/triggers/link/link.sh

11 lines
360 B
Bash
Raw Normal View History

2016-09-04 17:22:05 -04:00
[ -f functions.sh ] && source functions.sh
for l in $3 ; do
if [[ "${l}" =~ http://|https://|www\..* ]]; then
2020-08-10 09:35:15 -04:00
pageTitle="$(curl -L -s --connect-timeout 5 "$l" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}' | pandoc -t plain | tr '[:space:]' ' ')"
if [[ ${#pageTitle} -gt 1 ]]; then
msg "$2" "$pageTitle"
2016-09-04 17:22:05 -04:00
fi
fi
2016-09-04 17:22:05 -04:00
done