Fixed up the link trigger so it actually works, I think.
This commit is contained in:
parent
96c4bf8c24
commit
306d9aa671
@ -1,9 +1,13 @@
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
curl="$(command -v curl) --connect-timeout 5"
|
||||
for l in $3 ; do
|
||||
if [[ "${l#:}" =~ http://|https://|www\.*\.* ]]; then
|
||||
pageTitle="$($curl -Ls "${l#:}" | sed -n 's/<title>\(.*\)<\/title>/\1/p' | head -1 | html2text | tr -s '[:space:]' ' ')"
|
||||
if [[ "${l}" =~ http://|https://|www\..* ]]; then
|
||||
pageTitle="$(wget --quiet -O - "$l" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}')"
|
||||
|
||||
# Fix up pageTitle a bit.
|
||||
pageTitle="${pageTitle//'/\'}"
|
||||
pageTitle="${pageTitle//–/-}"
|
||||
|
||||
shortLink="${l#*://}"
|
||||
shortLink="${shortLink%%/*}"
|
||||
if [ ${#pageTitle} -gt 1 ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user