summaryrefslogtreecommitdiff
path: root/nocompile
diff options
context:
space:
mode:
Diffstat (limited to 'nocompile')
-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