anon

Untitled

Mar 26th, 2010
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.46 KB | None | 0 0
  1. ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*;
  2. ;             YouTube Video "Detector"           ;
  3. ;             Made by Kirby (Quakenet)           ;
  4. ;*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~;
  5.  
  6. ;// YouTube Detector Identifiers //
  7. alias -l addmark { return $+($sock($1).mark,$chr($3),$2) }
  8. alias -l smsg { msg $iif(c isincs $chan($1).mode,$1 $strip($2-),$1-) }
  9.  
  10. ;// YouTube Detector Text Event //
  11. on *:text:*youtube.com/watch?v=*:#: {
  12.   /set -e %bot.youtube.echan $chan
  13.   if (!$sock(youtube)) {
  14.     noop $regex($strip($1-),http:\/\/.*youtube.*\/watch\?v=(.{11})&?.*)
  15.     sockopen youtube www.youtube.com 80 | sockmark youtube $+(#,>,$regml(1))
  16.   }
  17. }
  18.  
  19. ;// YouTube Detector Socket (Video Information) //
  20. on *:sockopen:youtube: {
  21.   sockwrite -n $sockname GET $+(/watch?v=,$gettok($sock(youtube).mark,2,62)) HTTP/1.0
  22.   sockwrite -n $sockname Host: www.youtube.com
  23.   sockwrite -n $sockname $crlf
  24. }
  25. on *:sockread:youtube: {
  26.   var %x | sockread %x
  27.   if ($regex(%x,<meta\sname="title"\scontent="(.+)">)) sockmark youtube $addmark(youtube,Title: $+(,$regml(1),),62)
  28.   elseif ($regex(%x,"length_seconds":\s"(\w+)")) sockmark youtube $addmark(youtube,Duration: $+(,$duration($regml(1)),),62)
  29.   elseif ($regex(%x,title="(.+)">.+<span\sclass="smallText">(.+)\sratings<\/span>)) sockmark youtube $addmark(youtube,$+($regml(1),>,$regml(2)),62)
  30.   elseif ($regex(%x,view-count">(.+)<\/span>\s)) { sockmark youtube $addmark(youtube,$regml(1),62) }
  31.   elseif ($regex(%x,date">(.+)<\/span>)) sockmark youtube $addmark(youtube,$+($chr(40),uploaded on $regml(1),$chr(41)),62)
  32.   elseif ($regex(%x,<a\sclass="url"\shref="\/user\/(\w+)")) sockmark youtube $addmark(youtube,By: $+(,$regml(1),),62)
  33. }
  34. on *:sockclose:youtube: {
  35.   tokenize 62 $sock(youtube).mark | var %x $numtok($sock(youtube).mark,62)
  36.   if ($readini(%bot.inifile,$+(%bot.youtube.echan,@,$network),youtube) == on) && ($readini(%bot.inifile,universal,youtube) == on) { smsg $1 [1,0You0,4Tube]: $iif(%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.) }
  37. }
  38.  
  39. alias respond.youtube {
  40.   if (($1 == off) || (!$1)) { /writeini %bot.inifile $+($chan,@,$network) youtube off }
  41.   elseif ($1 == on) { /writeini %bot.inifile $+($chan,@,$network) youtube on }
  42.   elseif ($1 == universal) && (($2 == off) || (!$2)) { /writeini %bot.inifile universal youtube off }
  43.   elseif ($1 == universal) && ($2 == on) { /writeini %bot.inifile universal youtube on }
  44. }
  45.  
  46. on *:text:.respond youtube*:#: {
  47.   /set -e %bot.inifile youtubesettings.ini
  48.   /echo -a $1- called by $nick at $+($chan,@,$network)
  49.   if (($3 == off) || (!$3)) && ($nick isop $chan) { /writeini %bot.inifile $+($chan,@,$network) youtube off }
  50.   elseif ($3 == on) && ($nick isop $chan) { /writeini %bot.inifile $+($chan,@,$network) youtube on }
  51.   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. }
  52.   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. }
  53.   /set -e %bot.youtubectime $ctime
  54. }
  55.  
  56. ;EOF
Advertisement
Add Comment
Please, Sign In to add comment