summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2020-11-16 00:51:36 +0000
committerepoch <epoch@hack.thebackupbox.net>2020-11-16 00:51:36 +0000
commita75363e4d77a9f35a9e8fb1515945629aba97d9a (patch)
tree8fd915c610a0e8f282f956c20e765c4c758edced
parent82f7fe701000a5de6c753ef572621dad51e1eace (diff)
downloaduritools-a75363e4d77a9f35a9e8fb1515945629aba97d9a.tar.gz
uritools-a75363e4d77a9f35a9e8fb1515945629aba97d9a.zip
http redirects were being output twice in urititle
-rwxr-xr-xurititle8
1 files changed, 5 insertions, 3 deletions
diff --git a/urititle b/urititle
index 85f3259..662201c 100755
--- a/urititle
+++ b/urititle
@@ -25,9 +25,9 @@ http*)
if printf "%s\n" "${a_header}" | grep -i '^Content-Type: ' 2>&1 >/dev/null 2>&1;then
content_type="$(printf '%s\n' "${a_header}" | cut '-d ' -f2- | cut '-d;' -f1)"
fi
- if printf "%s\n" "${a_header}" | grep -i '^Location: ' 2>&1 >/dev/null 2>&1;then
- content_type="redirect. ${a_header}"
- fi
+ #if printf "%s\n" "${a_header}" | grep -i '^Location: ' 2>&1 >/dev/null 2>&1;then
+ # content_type="redirect. ${a_header}"
+ #fi
if printf "%s\n" "${a_hreader}" | grep -i '^curl failed' 2>&1 >/dev/null 2>&1;then
content_type="curl failed. cert expired? dunno yet. TODO: code openssl checker."
fi
@@ -70,6 +70,8 @@ gopher)
printf "title: %s\n" "$(curl -s "$1" | grep ^i | head -n1 | cut -f1 | cut -b2-)"
elif [ "$type" = 0 ];then
printf "title: %s\n" "$(curl -s "$1" | head -n1)"
+ elif [ "$type" = "h" ];then
+ printf "title: %s\n" "$(curl -s "$1" | head -c 1000000 | tr -d '\n' | tr '<' '\n' | grep -iA 10 '^title' | grep -iB 10 '^\/title>' | cut '-d>' -f2 | tr '\t' ' ' | sed 's/^ *//g' | sed 's/ *$//g' | grep .)"
else
printf "title: don't know how to get title of non-1 gopher links"
fi