diff options
author | epoch <epoch@hack.thebackupbox.net> | 2021-01-11 05:27:30 +0000 |
---|---|---|
committer | epoch <epoch@hack.thebackupbox.net> | 2021-01-11 05:27:30 +0000 |
commit | 43c5df05b6685ade9072349b85173c5983440057 (patch) | |
tree | a57dab5e16638630eaf06c606e13441bceaaf060 /urititle | |
parent | 298dfc554ac080c0aa7b2d96372c518b8d0cf2b7 (diff) | |
download | uritools-43c5df05b6685ade9072349b85173c5983440057.tar.gz uritools-43c5df05b6685ade9072349b85173c5983440057.zip |
added urn:ietf:rfc:#### title based on rfc database you can get from the ietf. also stopped printing ${content_type} because it was showing content type twice. no idea why I changed that in the first place.
Diffstat (limited to 'urititle')
-rwxr-xr-x | urititle | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -36,7 +36,7 @@ http*) title="$(curl -si "$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 .)" printf "title: %s\n" "$title" | html_entities_decode else - printf "%s %s\n" "${a_header}" "${content_type}" + printf "%s\n" "${a_header}" fi fi ;; @@ -76,6 +76,16 @@ gopher) printf "title: don't know how to get title of non-1 gopher links" fi ;; +urn) + nid="$(printf "%s\n" "$1" | cut -d: -f2)" + nss="$(printf "%s\n" "$1" | cut -d: -f3)" + nss2="$(printf "%s\n" "$1" | cut -d: -f4)" + if [ "$nid" = "ietf" ];then + if [ "$nss" = "rfc" ];then + cat "/var/db/rfc/rfc${nss2}.json" | jq .title + fi + fi + ;; ssh) if [ ! "$port" ];then port=22 |