on $*:TEXT:/(https?)\x3A\/\/(www\.)?([^\s\n\/]++)(\/\S*)?/Si:#:{
; Check if url contains skipped filetype
var %skiptypes png jpg jpeg txt | var %filetype $gettok($regml(3),-1,46)
if ($istok(%skiptypes,%filetype,32)) { halt }
; Start socket opening
if ($sock(title)) { sockclose title }
if ($regml(1) == http) { sockopen title $regml(2) 80 }
if ($regml(1) == https) { sockopen -e title $regml(2) 443 }
sockmark title $iif($regml(3),$v1,/) #
}
on *:SOCKOPEN:title:{
if ($sockerr) {
msg $gettok($sock(title).mark,2,32) Socket error: $sock(title).wsmsg
halt
}
sockwrite -nt $sockname GET $iif($gettok($sock($sockname).mark,1,32),$v1,/) HTTP/1.0
sockwrite -nt $sockname Host: $sock($sockname).addr
sockwrite -nt $sockname Connection: close
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:title:{
var %titletag
sockread %titletag
if ($regex(titletag,%titletag,/<title>([^\n<]*+)/)) {
msg $gettok($sock(title).mark,2,32) ^ $Xchr($left($regml(titletag,1),240))
sockclose $sockname
}
}
alias -l Xchr {
var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
return $replacecs(%return,–,–,·,·,»,»,«,«,Ü,Ü,ü,ü,Á,Á,á,á,É,$&
É,é,é,Í,Í,í,í,Ó,Ó,ó,ó,Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),$&
æ,æ,",",&,&)
}