A simple snippet that detects Youtube URLs said in the channel and displays the video title.
; YouTube Title Reader
; by SplitFire
on ^*:TEXT:*:#: {
if ($regex($strip($1-),/www\.youtube\.com\/(.+)/ig)) {
var %t $ticks
sockopen url. $+ %t www.youtube.com 80
sockmark url. $+ %t # $regml(1)
halt
}
}
on ^*:ACTION:*:#: {
if ($regex($strip($1-),/www\.youtube\.com\/(.+)/ig)) {
var %t $ticks
sockopen url. $+ %t www.youtube.com 80
sockmark url. $+ %t # $regml(1)
halt
}
}
on *:sockopen:url.*:{
sockwrite -n $sockname GET / $+ $gettok($sock($sockname).mark,2,32) HTTP/1.0
sockwrite -n $sockname Host: www.youtube.com
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
}
on *:sockread:url.*:{
var %ur
sockread %ur
if (%2nd) {
msg $gettok($sock($sockname).mark,1,32) [You0,4Tube] $right($remove(%ur,$chr(9)),-1)
sockclose $sockname
unset %2nd
halt
}
if (%1st) {
unset %1st
set %2nd x
halt
}
if (*<title> iswm %ur) {
set %1st x
halt
}
}
not working for me ><"