Just playing with it some..
on $*:text:/(youtube.com|youtu.be)\/(.*|v=)?([\w-]{11})/Si:*: {
if ($sock(yt)) { sockclose yt }
sockopen yt www.youtube.com 80
sockmark yt $regml(3) msg $iif($chan,$v1,$nick) $+(You,$chr(3),0,$chr(44),04,Tube,$chr(3)) Title:
}
on *:sockopen:yt:{
tokenize 32 $sock(yt).mark
sockwrite -n yt GET /watch?v= $+ $1 HTTP/1.1
sockwrite -n yt HOST: www.youtube.com $+ $str($crlf,2)
}
on *:sockread:yt:{
var %v
sockread %v
tokenize 32 $sock(yt).mark
if ($regex(%v,/"name" content="(.+)"/)) {
$2- $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38))
sockclose yt
} }
you dont need the vars, Good idea on the replace tho you only need it once.