2016-09-04 17:22:05 -04:00
|
|
|
[ -f functions.sh ] && source functions.sh
|
|
|
|
|
|
|
|
for l in $3 ; do
|
2020-08-09 20:55:19 -04:00
|
|
|
if [[ "${l}" =~ http://|https://|www\..* ]]; then
|
2020-08-09 21:28:25 -04:00
|
|
|
pageTitle="$(curl -s --connect-timeout 5 "$l" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}')"
|
2020-08-09 20:55:19 -04:00
|
|
|
|
|
|
|
# Fix up pageTitle a bit.
|
|
|
|
pageTitle="${pageTitle//'/\'}"
|
|
|
|
pageTitle="${pageTitle//–/-}"
|
|
|
|
|
2016-09-04 17:22:05 -04:00
|
|
|
shortLink="${l#*://}"
|
|
|
|
shortLink="${shortLink%%/*}"
|
2016-09-08 12:16:59 -04:00
|
|
|
if [ ${#pageTitle} -gt 1 ]; then
|
2016-09-04 17:22:05 -04:00
|
|
|
msg "$2" "$pageTitle at $shortLink"
|
|
|
|
fi
|
2016-09-04 20:51:49 -04:00
|
|
|
fi
|
2016-09-04 17:22:05 -04:00
|
|
|
done
|