Links reported more accurately.

This commit is contained in:
Storm Dragon 2020-08-10 18:39:43 -04:00
parent 9d503d2196
commit 521b862c1c

View File

@ -1,8 +1,9 @@
[ -f functions.sh ] && source functions.sh
for l in $3 ; do
if [[ "${l}" =~ http://|https://|www\..* ]]; then
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:]' ' ')"
text="${l#:}"
if [[ "${text}" =~ http://|https://|www\..* ]]; then
pageTitle="$(curl -L -s --connect-timeout 5 "$text" | 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"
fi