"Untitled" By anon (https://pastebin.com/u/anon) URL: https://pastebin.com/rA8GkMmx Created on: Friday 26th of March 2010 03:24:56 AM CDT Retrieved on: Friday 30 of October 2020 10:36:32 AM UTC ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*; ; 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=*:#: { /set -e %bot.youtube.echan $chan 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 %x | sockread %x if ($regex(%x,)) sockmark youtube $addmark(youtube,Title: $+(,$regml(1),),62) elseif ($regex(%x,"length_seconds":\s"(\w+)")) sockmark youtube $addmark(youtube,Duration: $+(,$duration($regml(1)),),62) elseif ($regex(%x,title="(.+)">.+(.+)\sratings<\/span>)) sockmark youtube $addmark(youtube,$+($regml(1),>,$regml(2)),62) elseif ($regex(%x,view-count">(.+)<\/span>\s)) { sockmark youtube $addmark(youtube,$regml(1),62) } elseif ($regex(%x,date">(.+)<\/span>)) sockmark youtube $addmark(youtube,$+($chr(40),uploaded on $regml(1),$chr(41)),62) elseif ($regex(%x,= 7,$3 $chr(124) $5 $6 $chr(124) $4 $chr(124) Views: $+(,$iif(%x == 7,$7,$9),) $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.) } } alias respond.youtube { if (($1 == off) || (!$1)) { /writeini %bot.inifile $+($chan,@,$network) youtube off } elseif ($1 == on) { /writeini %bot.inifile $+($chan,@,$network) youtube on } elseif ($1 == universal) && (($2 == off) || (!$2)) { /writeini %bot.inifile universal youtube off } elseif ($1 == universal) && ($2 == on) { /writeini %bot.inifile universal youtube on } } on *:text:.respond youtube*:#: { /set -e %bot.inifile youtubesettings.ini /echo -a $1- called by $nick at $+($chan,@,$network) if (($3 == off) || (!$3)) && ($nick isop $chan) { /writeini %bot.inifile $+($chan,@,$network) youtube off } elseif ($3 == on) && ($nick isop $chan) { /writeini %bot.inifile $+($chan,@,$network) youtube on } elseif ($3 == status) && ($nick isop $chan) && (($readini(%bot.inifile,$+($chan,@,$network),youtube) == off) || (!$readini(%bot.inifile,$+($chan,@,$network),youtube))) && ($calc($ctime - %bot.youtubectime) > 3) { /msg $chan Youtube detector is set to OFF. } elseif ($3 == status) && ($nick isop $chan) && ($readini(%bot.inifile,$+($chan,@,$network),youtube) == on) && ($calc($ctime - %bot.youtubectime) > 3) { /msg $chan Youtube detector is set to ON. } /set -e %bot.youtubectime $ctime } ;EOF