Working link parser.
This commit is contained in:
parent
3fcf1c280f
commit
a190c08bdf
@ -1,8 +1,9 @@
|
|||||||
[ -f functions.sh ] && source functions.sh
|
[ -f functions.sh ] && source functions.sh
|
||||||
|
|
||||||
|
curl="$(command -v curl)"
|
||||||
for l in $3 ; do
|
for l in $3 ; do
|
||||||
if [[ "$l" =~ http://|https://|www\.* ]]; then
|
if [[ "$l" =~ http://|https://|www\.* ]]; then
|
||||||
pageTitle="$(curl -s "$l" | grep "<title>" | sed 's#\(</\|</\)title>##g')"
|
pageTitle="$($curl -Ls "${l/#:/}" | grep "<title>" | html2text | tr '[:space:]' ' ')"
|
||||||
shortLink="${l#*://}"
|
shortLink="${l#*://}"
|
||||||
shortLink="${shortLink%%/*}"
|
shortLink="${shortLink%%/*}"
|
||||||
msg "$2" "$pageTitle at $shortLink"
|
msg "$2" "$pageTitle at $shortLink"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user