Advertisement
illpastethat

YouTube Script (Parse Vids and Search) v4.5

Mar 19th, 2012
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 18.32 KB | None | 0 0
  1. ;YouTube Script (Parse Vids and Search) v4.5
  2. ;Made by nick1
  3. ;Last edit March 20 2012
  4. ;For help type /YouTube in mIRC
  5. ;2D0 -- Download videos in a few formats [[possible?]], anything else?
  6. ;EDITS -- Changed dialog to add options for views length and user (all optional but default on), minor changes to look of the GUI
  7.  
  8. menu status,channel,query {
  9.   YouTube:youtube
  10. }
  11.  
  12. alias YouTube {
  13.   dialog -m YouTube YouTube
  14. }
  15.  
  16. dialog Youtube {
  17.   title "YouTube Script (Parse Vids and Search) v4.5"
  18.   size -1 -1 219 136
  19.   option dbu
  20.   icon $mircdir $+ Youtube.ico, 0
  21.   link "View Script On Hawkee -- Report Bugs Here", 1, 58 3 105 8
  22.   button "Exit", 7, 75 123 72 12, cancel
  23.   tab "About", 10, 2 10 214 111
  24.   text "This script was created by nick1 (Rizon Network)", 18, 49 25 116 8, tab 10
  25.   text "Last updated on March 20, 2012", 19, 7 38 83 8, tab 10
  26.   text "Please post suggestions, complaints, or bugs on the hawkee link (or in chat)", 20, 7 49 188 8, tab 10
  27.   text "The script automatically will attempt to protect itself from spam and won't parse the same link twice in a row", 21, 7 60 205 14, tab 10
  28.   text "!commands will notice the user; @commands will be public to the channel", 13, 7 93 175 8, tab 10
  29.   text "Default behavior is to run on every channel for every nick. Use the Nick and Channel Settings Tabs to change it for invidividual channels or nicks.", 65, 7 76 208 14, tab 10
  30.   link "Click here to chat (leave a message for nick1)", 66, 95 38 110 8, tab 10
  31.   text "Use the Basic Options Tab to adjust which parts of the script will run and basic formatting options.", 23, 7 104 207 13, tab 10
  32.   tab "Basic Options", 2
  33.   text "The script will return: Link (for search), Title, Views, Length, and User", 58, 11 86 182 8, tab 2
  34.   box "Search Commands -- Prefix With ! or @ --", 60, 7 54 186 20, tab 2
  35.   text "youtube <search terms>; ytsearch <search>; ysearch <search terms>", 62, 10 62 175 8, tab 2
  36.   box "Disable Script -- Search or Parse Functions --", 5, 7 29 155 21, tab 2
  37.   check "Disable Search Function", 11, 13 37 68 10, tab 2 flat
  38.   check "Disable Parse Function", 14, 92 37 65 10, tab 2 flat
  39.   box "Output Options -- How the Bot Will Return Info --", 9, 7 78 194 40, tab 2
  40.   check "Disable Views", 15, 11 95 45 10, tab 2
  41.   check "Disable Length", 16, 65 95 47 10, tab 2
  42.   check "Disable User", 17, 121 95 43 10, tab 2
  43.   check "Disable Color Formatting (Colorized and Bold) -- Plain if checked", 22, 11 105 167 10, tab 2
  44.   tab "Channel Settings", 3
  45.   list 6, 8 57 202 54, tab 3 sort size extsel vsbar
  46.   edit "", 8, 9 27 155 25, tab 3 multi autohs autovs
  47.   text "List of channels the script will NOT run on", 12, 48 51 101 6, tab 3
  48.   button "Add", 4, 172 28 37 12, tab 3
  49.   button "Remove", 63, 172 43 37 12, tab 3
  50.   button "Click here to enter #channels ...", 64, 10 28 153 23, tab 3
  51.   tab "Nick Settings", 26
  52.   text "List of nicks the script will NOT run for", 70, 48 51 101 6, tab 26
  53.   list 71, 8 57 202 54, tab 26 sort size extsel vsbar
  54.   button "Remove", 72, 172 43 37 12, tab 26
  55.   button "Add", 73, 172 28 37 12, tab 26
  56.   edit "", 69, 9 27 155 25, tab 26 multi autohs autovs
  57.   button "Click here to enter Nicks ...", 74, 10 28 153 23, tab 26
  58.   tab "Just For Fun", 68
  59.   text "See if you can check all the checkboxes! Warning: there might not be a reward.", 27, 25 53 144 14, tab 68
  60.   check "Check Box", 44, 123 25 50 10, tab 68
  61.   check "Check Box", 43, 130 33 50 10, tab 68
  62.   check "Check Box", 53, 135 43 50 10, tab 68
  63.   check "Check Box", 42, 128 59 50 10, tab 68
  64.   check "Check Box", 51, 130 74 50 10, tab 68
  65.   check "Check Box", 41, 112 68 50 10, tab 68
  66.   check "Check Box", 35, 87 74 50 10, tab 68
  67.   check "Check Box", 34, 76 83 50 10, tab 68
  68.   check "Check Box", 39, 82 93 50 10, tab 68
  69.   check "Check Box", 55, 90 99 50 10, tab 68
  70.   check "Check Box", 38, 132 101 50 10, tab 68
  71.   check "Check Box", 47, 131 91 50 10, tab 68
  72.   check "Check Box", 37, 125 83 50 10, tab 68
  73.   check "Check Box", 54, 48 100 50 10, tab 68
  74.   check "Check Box", 49, 26 102 50 10, tab 68
  75.   check "Check Box", 40, 29 94 50 10, tab 68
  76.   check "Check Box", 56, 33 84 50 10, tab 68
  77.   check "Check Box", 33, 18 81 50 10, tab 68
  78.   check "Check Box", 48, 14 69 50 10, tab 68
  79.   check "Check Box", 50, 39 70 50 10, tab 68
  80.   check "Check Box", 52, 79 64 50 10, tab 68
  81.   check "Check Box", 46, 81 42 50 10, tab 68
  82.   check "Check Box", 36, 94 32 50 10, tab 68
  83.   check "Check Box", 45, 47 38 50 10, tab 68
  84.   check "Check Box", 31, 27 34 50 10, tab 68
  85.   check "Check Box", 30, 42 26 50 10, tab 68
  86.   check "Check Box", 28, 7 26 50 10, tab 68
  87.   check "Check Box", 29, 8 36 50 10, tab 68
  88.   check "Check Box", 32, 6 44 50 10, tab 68
  89.   check "Check Box", 75, 152 77 50 10, tab 68
  90.   check "Check Box", 76, 162 38 50 10, tab 68
  91.   check "Check Box", 77, 164 25 50 10, tab 68
  92.   check "Check Box", 78, 42 109 50 10, tab 68
  93.   check "Check Box", 79, 165 87 50 10, tab 68
  94.   check "Check Box", 80, 162 110 50 10, tab 68
  95.   check "Check Box", 81, 147 106 50 10, tab 68
  96.   check "Check Box", 82, 164 65 50 10, tab 68
  97.   check "Check Box", 83, 5 75 50 10, tab 68
  98.   check "Check Box", 84, 155 58 50 10, tab 68
  99.   check "Check Box", 85, 6 108 50 10, tab 68
  100.   check "Check Box", 86, 76 107 50 10, tab 68
  101.   check "Check Box", 87, 6 90 50 10, tab 68
  102. }
  103.  
  104. on *:dialog:youtube:init:0: {
  105.   FillChannelBox
  106.   FillNickBox
  107.   $iif(%_youtube.nocolor == true,did -c youtube 22,noop)
  108.   $iif(%_youtube.noviews == true,did -c youtube 15,noop)
  109.   $iif(%_youtube.nolength == true,did -c youtube 16,noop)
  110.   $iif(%_youtube.nouser == true,did -c youtube 17,noop)
  111.   $iif($group(#search) != on,did -c youtube 11,noop)
  112.   $iif($group(#parse) != on,did -c youtube 14,noop)  
  113. }
  114.  
  115. alias FillChannelBox {
  116.   did -r youtube 6
  117.   var %y 1
  118.   while (%y <= $numtok(%youtubefetch,44)) {
  119.     did -a youtube 6 $gettok(%youtubefetch,%y,44)
  120.     inc %y
  121.   }
  122. }
  123.  
  124. alias FillNickBox {
  125.   did -r youtube 71
  126.   var %y 1
  127.   while (%y <= $numtok(%nolinks,44)) {
  128.     did -a youtube 71 $gettok(%nolinks,%y,44)
  129.     inc %y
  130.   }
  131. }
  132.  
  133. on *:dialog:youtube:sclick:*: {
  134.   if ($did == 1) {
  135.     run http://www.hawkee.com/snippet/8577/
  136.   }
  137.   elseif ($did == 66) {
  138.     run https://qchat.rizon.net/?&channels=#rsbot_help&nick=YouTube..
  139.   }
  140.   elseif ($did == 22) {
  141.     set %_youtube.nocolor $iif($did(22).state,true,false)
  142.   }
  143.   elseif ($did == 15) {
  144.     set %_youtube.noviews $iif($did(15).state,true,false)
  145.   }
  146.   elseif ($did == 16) {
  147.     set %_youtube.nolength $iif($did(16).state,true,false)
  148.   }
  149.   elseif ($did == 17) {
  150.     set %_youtube.nouser $iif($did(17).state,true,false)
  151.   }
  152.   elseif ($did == 11) {
  153.     $iif($group(#search) == on,.disable,.enable) #search
  154.   }
  155.   elseif ($did == 14) {
  156.     $iif($group(#parse) == on,.disable,.enable) #parse
  157.   }
  158.   elseif ($did == 4) {
  159.     set %youtubefetch $addtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
  160.     did -r youtube 8
  161.     FillChannelBox
  162.   }
  163.   elseif ($did == 73) {
  164.     set %nolinks $addtok(%nolinks,$did(69),44)
  165.     did -r youtube 69
  166.     FillNickBox
  167.   }
  168.   elseif ($did == 63) {
  169.     if ($did(8) != $null) {
  170.       set %youtubefetch $remtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
  171.       did -r youtube 8
  172.     }
  173.     if ($did(6).seltext != $null) {
  174.       set %youtubefetch $remtok(%youtubefetch,$did(6).seltext,44)
  175.     }
  176.     FillChannelBox
  177.   }
  178.   elseif ($did == 3) {
  179.     did -t youtube 4
  180.   }
  181.   elseif ($did == 26) {
  182.     did -t youtube 73
  183.   }
  184.   elseif ($did == 72) {
  185.     if ($did(69) != $null) {
  186.       set %nolinks $remtok(%nolinks,$did(69),44)
  187.       did -r youtube 69
  188.     }
  189.     if ($did(71).seltext != $null) {
  190.       set %nolinks $remtok(%nolinks,$did(71).seltext,44)
  191.     }
  192.     FillNickBox
  193.   }
  194.   elseif ($did isnum 28-56) {
  195.     var %r $r(1,2)
  196.     if (%r == 1) {
  197.       $iif(($r(1,3) == 1),.timercheck -m 1 13 did -c youtube $r(75,87),.timeruncheck -m 1 13 did -u youtube $r(75,87))
  198.     }
  199.     else {
  200.       $iif(($r(1,3) == 1),.timercheck -m 1 13 did -c youtube $r(28,56),.timeruncheck -m 1 13 did -u youtube $r(28,56))
  201.     }
  202.   }
  203.   elseif ($did isnum 75-87) {
  204.     var %r $r(1,2)
  205.     if (%r == 1) {
  206.       $iif(($r(1,3) == 1),.timercheck -m 1 13 did -c youtube $r(75,87),.timeruncheck -m 1 13 did -u youtube $r(75,87))
  207.     }
  208.     else {
  209.       $iif(($r(1,3) == 1),.timercheck -m 1 13 did -c youtube $r(28,56),.timeruncheck -m 1 13 did -u youtube $r(28,56))
  210.     }
  211.   }
  212. }
  213.  
  214. raw 408:*: msg $2 $remove($strip($13-),$chr(9))
  215.  
  216. alias urlencode {
  217.   return $replacex($regsubex($$1-,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),+,$chr(43),%2B)
  218. }
  219.  
  220. #search on
  221. on $*:text:/^[!@]y(outube|t|tsearch|search|ousearch|outubesearch)(\s|$)/Si:*: {
  222.   $iif($istok(%youtubefetch,$chan,44),halt,noop)
  223.   $iif($istok(%nolinks,$nick,44),halt,noop)
  224.   if ($($+(%,botflood.,$nick),2)) {
  225.     if ($($+(%,botflood.,$nick),2) >= 50) {
  226.       ignore -u60 $address($nick,2)
  227.       msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
  228.       halt
  229.     }
  230.     elseif ($($+(%,botflood.,$nick),2) >= 40) {
  231.       msg $chan $+($nick,$chr(44)) Please do not flood the bot.
  232.       inc -z $+(%,botflood.,$nick) 20
  233.       halt
  234.     }
  235.     else {
  236.       inc -z $+(%,botflood.,$nick) 25
  237.     }
  238.   }
  239.   else {
  240.     inc -z $+(%,botflood.,$nick) 25
  241.   }
  242.   var %ticks $ticks
  243.   if ($2) {
  244.     set $+(%,ysearch.,%ticks,.msgtype) $iif($chan,$iif($left($strip($1),1) == @,msg $chan,notice $nick),msg $nick)
  245.     set $+(%,ysearch.,%ticks,.search) $2-
  246.     set $+(%,ysearch.,%ticks,.search) $urlencode($2-)
  247.     sockopen $+(ysearch.,%ticks) gdata.youtube.com 80
  248.   }
  249.   elseif ($2 == $null) {
  250.     notice $nick 4Incorrect Syntax - Use10 $1 <search term>
  251.   }
  252. }
  253.  
  254. on *:input:*:{
  255.   $iif($istok(%nolinks,$active,44),return,noop)
  256.   $iif($istok(%youtubefetch,$active,44),return,noop)
  257.   var %ticks $ticks
  258.   if (($remove($1,$left($strip($1),1)) == ysearch) || ($remove($1,$left($strip($1),1)) == ytsearch) || ($remove($1,$left($strip($1),1)) == youtube) || ($remove($1,$left($strip($1),1)) == yt) || ($remove($1,$left($strip($1),1)) == youtubesearch)) {
  259.     if ($left($1,1) != /) {
  260.       if ($2 != $null) {
  261.         set $+(%,ysearch.,%ticks,.msgtype) msg $active
  262.         set $+(%,ysearch.,%ticks,.search) $2-
  263.         set $+(%,ysearch.,%ticks,.query) $urlencode($2-)
  264.         sockopen $+(ysearch.,%ticks) gdata.youtube.com 80
  265.       }
  266.       elseif ($2 == $null) {
  267.         .timerYTInputSyntax -m 1 100 echo -at 4Incorrect Syntax - Use10 $1 <search term>
  268.       }
  269.     }
  270.   }
  271.   elseif ((*youtube.com* iswm $1-) || (*youtu.be* iswm $1-)) {
  272.     if ($left($1,1) != /) {
  273.       var %i 1
  274.       while (%i <= $numtok($1-,32)) {
  275.         if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
  276.           set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
  277.           var %tag $($+(%,youtube.,%ticks,.url),2)
  278.           var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
  279.           var %tag $deltok($deltok(%tag,2,35),2,38)
  280.           set $+(%,youtube.,%ticks,.tag) $remove(%tag,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
  281.         }
  282.         inc %i
  283.       }
  284.       if ($($+(%,youtube.,%ticks,.tag),2) == $null) {
  285.         unset $+(%,youtube.,%ticks,.*)
  286.       }
  287.       else {
  288.         set $+(%,youtube.,%ticks,.msgtype) msg $active
  289.         set $+(%,youtube.,%ticks,.nick) $nick
  290.         set $+(%,youtube.,%ticks,.chan) $chan
  291.         set $+(%,youtube.,%ticks,.network) $network
  292.         sockopen $+(youtube.,%ticks) gdata.youtube.com 80
  293.       }
  294.     }
  295.   }
  296. }
  297.  
  298. on *:sockopen:ysearch*: {  
  299.   sockwrite -nt $sockname GET $+(/feeds/api/videos?q=,$($+(%,ysearch.,$remove($sockname,ysearch.),.query),2),&v=2&prettyprint=true&max-results=1) HTTP/1.1
  300.   sockwrite -nt $sockname Host: gdata.youtube.com
  301.   sockwrite -nt $sockname $crlf
  302. }
  303.  
  304. alias nohtml { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
  305.  
  306. on *:SOCKREAD:ysearch*: {
  307.   if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  308.   sockread %sockreader
  309.   if (*<title>* iswm %sockreader) {
  310.     set $+(%,ysearch.,$remove($sockname,ysearch.),.title) $replace($nohtml(%sockreader),&amp;quot;,",&amp;#39;,',&quot;,",&amp;,&,&#39;,',&quot;,")
  311.     var %i 0
  312.     while (%i <= $numtok($($+(%,ysearch.,$remove($sockname,ysearch.),.search),2),32)) {
  313.       inc %i
  314.       set $+(%,ysearch.,$remove($sockname,ysearch.),.title) $regsubex($($+(%,ysearch.,$remove($sockname,ysearch.),.title),2), /\b( $gettok($($+(%,ysearch.,$remove($sockname,ysearch.),.search),2),%i,32) )\b/gix, $+($chr(2), \1, $chr(2)))
  315.     }
  316.   }
  317.   elseif (*<id>* iswm %sockreader) {
  318.     set $+(%,ysearch.,$remove($sockname,ysearch.),.tag) $gettok($nohtml(%sockreader),4,58)
  319.   }
  320.   elseif (*<name>* iswm %sockreader) {
  321.     set $+(%,ysearch.,$remove($sockname,ysearch.),.user) $nohtml(%sockreader)
  322.   }
  323.   elseif (*<yt:duration seconds='* iswm %sockreader) {
  324.     var %t $duration($gettok(%sockreader,2,39),3)
  325.     if (($gettok(%t,2,58) == 00) && ($gettok(%t,1,58) == 00)) {
  326.       %t = $puttok(%t,0,2,58)
  327.     }
  328.     if (($left($gettok(%t,2,58),1) == 0) && ($right($gettok(%t,2,58),1) != 0) && ($right($gettok(%t,2,58),1) isnum)) {
  329.       %t = $puttok(%t,$right($gettok(%t,2,58),1),2,58)
  330.     }
  331.     if (($left($gettok(%t,1,58),1) == 0) && ($right($gettok(%t,1,58),1) != 0) && ($right($gettok(%t,1,58),1) isnum)) {
  332.       %t = $puttok(%t,$right($gettok(%t,1,58),1),1,58)
  333.     }
  334.     $iif($gettok(%t,1,58) == 00,%t = $gettok(%t,2-3,58),noop)
  335.     set $+(%,ysearch.,$remove($sockname,ysearch.),.time) %t
  336.   }
  337.   elseif (*<yt:statistics* iswm %sockreader) {
  338.     set $+(%,ysearch.,$remove($sockname,ysearch.),.viewcount) $bytes($gettok(%sockreader,4,39),bd)
  339.     var %msg 1,0You0,4Tube 10Link:4 http://youtu.be/ $+ $($+(%,ysearch.,$remove($sockname,ysearch.),.tag),2) $&
  340.       10Title:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.title),2) $&
  341.       $iif(%_youtube.noviews == true,$null,10Views:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.viewcount),2)) $&
  342.       $iif(%_youtube.nolength == true,$null,10Length:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.time),2)) $&
  343.       $iif(%_youtube.nouser == true,$null,10User:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.user),2))
  344.     $($+(%,ysearch.,$remove($sockname,ysearch.),.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
  345.     unset $+(%,ysearch.,$remove($sockname,ysearch.),*)
  346.     sockclose $sockname
  347.   }
  348. }
  349.  
  350. #search end
  351.  
  352. #parse on
  353. on $*:text:/youtu(.be|be.com)/Si:*: {
  354.   $iif($istok(%youtubefetch,$chan,44),halt,noop)
  355.   $iif($istok(%nolinks,$nick,44),halt,noop)
  356.   if ($($+(%,botflood.,$nick),2)) {
  357.     if ($($+(%,botflood.,$nick),2) >= 50) {
  358.       ignore -u60 $address($nick,2)
  359.       msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
  360.       halt
  361.     }
  362.     elseif ($($+(%,botflood.,$nick),2) >= 40) {
  363.       msg $chan $+($nick,$chr(44)) Please do not flood the bot.  
  364.       inc -z $+(%,botflood.,$nick) 20
  365.       halt
  366.     }
  367.     else {
  368.       inc -z $+(%,botflood.,$nick) 10
  369.     }
  370.   }
  371.   else { inc -z $+(%,botflood.,$nick) 10 }
  372.   var %i 1
  373.   var %ticks $ticks
  374.   while (%i <= $numtok($1-,32)) {
  375.     if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
  376.       set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
  377.       var %tag $($+(%,youtube.,%ticks,.url),2)
  378.       var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
  379.       var %tag $deltok($deltok(%tag,2,35),2,38)
  380.       set $+(%,youtube.,%ticks,.tag) $remove(%tag,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
  381.     }
  382.     inc %i
  383.   }
  384.   set $+(%,youtube.,%ticks,.msgtype) msg $iif($chan,$v1,$nick)
  385.   if (($($+(%,youtube.,%ticks,.tag),2) != %_youtube.last) && ($($+(%,youtube.,%ticks,.tag),2) != $null)) {
  386.     set $+(%,youtube.,%ticks,.nick) $nick
  387.     set $+(%,youtube.,%ticks,.chan) $chan
  388.     set $+(%,youtube.,%ticks,.network) $network
  389.     sockopen $+(youtube.,%ticks) gdata.youtube.com 80
  390.   }
  391. }
  392.  
  393. on *:sockopen:youtube*: {
  394.   sockwrite -nt $sockname GET $+(/feeds/api/videos/,$($+(%,youtube.,$remove($sockname,youtube.),.tag),2),?v=2&prettyprint=true) HTTP/1.1
  395.   sockwrite -nt $sockname Host: gdata.youtube.com
  396.   sockwrite -nt $sockname $crlf
  397. }
  398.  
  399. on *:SOCKREAD:youtube*: {
  400.   if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  401.   else {
  402.     var %sockreader
  403.     sockread %sockreader
  404.     if (*<title>* iswm %sockreader) {
  405.       set $+(%,youtube.,$remove($sockname,youtube.),.title) $replace($nohtml(%sockreader),&amp;quot;,",&amp;#39;,',&quot;,",&amp;,&,&#39;,',&quot;,")
  406.     }
  407.     elseif (*<name>* iswm %sockreader) {
  408.       set $+(%,youtube.,$remove($sockname,youtube.),.user) $nohtml(%sockreader)
  409.     }
  410.     elseif (*<yt:duration seconds='* iswm %sockreader) {
  411.       var %t $duration($gettok(%sockreader,2,39),3)
  412.       if (($gettok(%t,2,58) == 00) && ($gettok(%t,1,58) == 00)) {
  413.         %t = $puttok(%t,0,2,58)
  414.       }
  415.       if (($left($gettok(%t,2,58),1) == 0) && ($right($gettok(%t,2,58),1) != 0) && ($right($gettok(%t,2,58),1) isnum)) {
  416.         %t = $puttok(%t,$right($gettok(%t,2,58),1),2,58)
  417.       }
  418.       if (($left($gettok(%t,1,58),1) == 0) && ($right($gettok(%t,1,58),1) != 0) && ($right($gettok(%t,1,58),1) isnum)) {
  419.         %t = $puttok(%t,$right($gettok(%t,1,58),1),1,58)
  420.       }
  421.       $iif($gettok(%t,1,58) == 00,%t = $gettok(%t,2-3,58),noop)
  422.       set $+(%,youtube.,$remove($sockname,youtube.),.time) %t
  423.     }
  424.     elseif (*viewCount='* iswm %sockreader) {
  425.       set $+(%,youtube.,$remove($sockname,youtube.),.viewcount) $bytes($gettok(%sockreader,4,39),bd)
  426.       set %_youtube.last $($+(%,youtube.,$remove($sockname,youtube.),.tag),2)
  427.       var %msg 1,0You0,4Tube 10Title:4 $($+(%,youtube.,$remove($sockname,youtube.),.title),2) $&
  428.         $iif(%_youtube.noviews == true,$null,10Views:4 $($+(%,youtube.,$remove($sockname,youtube.),.viewcount),2)) $&
  429.         $iif(%_youtube.nolength == true,$null,10Length:4 $($+(%,youtube.,$remove($sockname,youtube.),.time),2)) $&
  430.         $iif(%_youtube.nouser == true,$null,10User:4 $($+(%,youtube.,$remove($sockname,youtube.),.user),2))
  431.       $($+(%,youtube.,$remove($sockname,youtube.),.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
  432.       unset $+(%,youtube.,$remove($sockname,youtube.),*)
  433.       sockclose $sockname
  434.     }
  435.   }
  436. }
  437. #parse end
  438.  
  439. on *:sockclose:youtube*: {
  440.   unset $+(%,youtube.,$remove($sockname,youtube.),*)
  441.   sockclose $sockname
  442. }
  443.  
  444. on *:sockclose:ysearch*: {
  445.   unset $+(%,ysearch.,$remove($sockname,ysearch.),*)
  446.   sockclose $sockname
  447. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement