;alias yt { ; if (youtube.com/watch?v= isin $1-) { ; if (http:// isin $1-) %ytpath = / $+ $gettok($gettok($1-,3,47),1,38) ; else %ytpath = / $+ $gettok($gettok($1-,2,47),1,38) ; sockclose yt ; sockopen yt youtube.com 80 ; } ; else { ; echo -a $chr(91) $+ $time $+ $chr(93) YouTube: syntax error ; } ;} on *:text:*youtube.com/watch?v=*:*:{ if (http:// isin $1-) %ytpath = / $+ $gettok($gettok($1-,3,47),1,38) else %ytpath = / $+ $gettok($gettok($1-,2,47),1,38) %ytnick = $nick %ytchan = $chan sockclose yt sockopen yt youtube.com 80 } on *:sockopen:yt:{ if ($sockerr) { echo -a $chr(91) $+ $time $+ $chr(93) YouTube: socket error | halt } sockwrite -n $sockname GET %ytpath HTTP/1.1 sockwrite -n $sockname Host: youtube.com sockwrite -n $sockname $crlf } on *:sockread:yt: { :read ;sockread &temp ;bwrite yt.txt -1 -1 &temp sockread -f %ytread ; if ( isin %ytread) { ; if (%ytchan != $null) { msg %ytchan YouTube: %ytpath $remove(%ytread,<title>,) | goto gettitle } ; if (%ytchan == $null && %ytnick != $null) { msg %ytnick YouTube: %ytpath $remove(%ytread,,) } ; } :gettitle if (*"video_title"* iswm %ytread ) { noop $regex(%ytread,/

(.*?)

/Si) set %titles $remove($regml(1),

,

) if (%ytchan != $null) { msg %ytchan %ytpath Title: %titles | goto getdesc } if (%ytchan == $null && %ytnick != $null) { msg %ytnick %ytpath Title: %titles } } :getdesc if (*"vidDescRemain"* iswm %ytread ) { noop $regex(%ytread,/(.*?)/Si) set %descs $remove($regml(1), ,,
,
) if (%ytchan != $null) { msg %ytchan %ytpath Description: %descs | goto end } if (%ytchan == $null && %ytnick != $null) { msg %ytnick %ytpath Description: %descs } } :end if ($sockbr) goto read }