aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepochqwert <epoch@hacking.allowed.org>2017-12-01 09:24:41 +0000
committerepochqwert <epoch@hacking.allowed.org>2017-12-01 09:24:41 +0000
commitd573108c4c13ed4025473bcd2693b0e665fb5cbb (patch)
treea97bedbe5a8b007d250e2605eddbc1f17f3e3713
parente29593958560110f891be1838d984a05c137669e (diff)
downloadmisc-d573108c4c13ed4025473bcd2693b0e665fb5cbb.tar.gz
misc-d573108c4c13ed4025473bcd2693b0e665fb5cbb.zip
copied over the updated title.sh
-rwxr-xr-xnocompile/bin/title.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/nocompile/bin/title.sh b/nocompile/bin/title.sh
new file mode 100755
index 0000000..32b0deb
--- /dev/null
+++ b/nocompile/bin/title.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+export PATH=/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin
+printf '%s\n' "$1" | grep -Fvf /var/log/toirc/links >> /var/log/toirc/links
+#wget -4 --user-agent="" -qO- "$1"
+type="$(/usr/pkg/bin/curl -sA "" -I -4 "$1" | grep -i "Content-Type" | cut '-d ' -f2)"
+if printf "%stext/html\n" "$type" | grep "^text/html" >/dev/null 2>&1 ;then
+ echo -n "title: "
+ /usr/pkg/bin/curl -sA "" -4 "$1" | tr '>' '\n' | XuntilY "<[Tt][Ii][Tt][Ll][Ee]" "</[Tt][Ii][Tt][Ll][Ee]" | sed 's/<.*$//' | tr '\t' ' ' | grep -a '[^ ]' | decode_html_entities
+else
+ echo "content-type: $type"
+fi