blob: 32b0deba204b4290b01c6073bfe9bc5a0464d1a8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
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
|