;SOF ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*; ; YouTube Video "Detector" ; ; Made by Kirby (Quakenet) ; ;*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~; ;// YouTube Detector Identifiers // alias -l addmark { return $+($sock($1).mark,$chr($3),$2) } alias -l smsg { msg $iif(c isincs $chan($1).mode,$1 $strip($2-),$1-) } ;// YouTube Detector Text Event // on *:text:*youtube.com/watch?v=*:#: { if (!$sock(youtube)) { noop $regex($strip($1-),http:\/\/.*youtube.*\/watch\?v=(.{11})&?.*) sockopen youtube www.youtube.com 80 | sockmark youtube $+(#,>,$regml(1)) } } ;// YouTube Detector Socket (Video Information) // on *:sockopen:youtube: { sockwrite -n $sockname GET $+(/watch?v=,$gettok($sock(youtube).mark,2,62)) HTTP/1.0 sockwrite -n $sockname Host: www.youtube.com sockwrite -n $sockname $crlf } on *:sockread:youtube: { var %yt | sockread %yt if ($regex(%yt,/

(.+)<\/h1>/)) sockmark youtube $addmark(youtube,Title: $+(,$regml(1),),62) elseif ($regex(%yt,/"length_seconds": "(\d+)/) ) sockmark youtube $addmark(youtube,Duration: $+(,$duration($regml(1)),),62) elseif ($regex(%yt,/ratingL-(.+)"\stitle|"smallText">(.+)\sratings<\/span>/g)) sockmark youtube $addmark(youtube,$+($regml(1),>,$regml(2)),62) elseif ($regex(%yt,/"watch-view-count">(.+)<\/span>\svi/)) sockmark youtube $addmark(youtube,$regml(1),62) elseif ($regex(%yt,date">(.+)<\/span>)) sockmark youtube $addmark(youtube,$+($chr(40),uploaded on $regml(1),$chr(41)),62) elseif ($regex(%yt,= 7,$4 $chr(124) $5 $6 $chr(124) $3 $chr(124) Views: $+(,$iif(%x == 9,$9,$8),) $chr(124) Rating: $iif(%x == 9,$+(,$7,) $+($chr(40),$8 $iif($8 == 1,rating,ratings),$chr(41),),$+(,Ratings were disabled,)),Either the video doesn't exist or it contained a malformed video ID.) } ;EOF