From a75363e4d77a9f35a9e8fb1515945629aba97d9a Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 16 Nov 2020 00:51:36 +0000 Subject: http redirects were being output twice in urititle --- urititle | 8 +++++--- 1 file 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 -- cgit v1.2.3