Jump to content
coders-irc_Bot

YouTube Script 2.0

Recommended Posts

  • Administrators

ntended for a channel bot.

Just copy and paste into remotes.

mIRC 6.35+

Gives information on youtube links when posted in the channel, and can now also do YOUTBUE SEARCHES!

Triggered when YouTube link is posted in chat....

YouTube Link Info:

[15:42] <@Neo-Nemesis> http://www.youtube.com/watch?v=rwY3Ftfdy6M
[15:42] <@Boris_III> YouTube Title: Iron Maiden - Killers
[15:42] <@Boris_III> YouTube Info: Iron Maiden - Killers Members: Paul Di'Anno - vocals Steve Harris - bass guitar Dave Murray - guitar Adrian Smith - guitar Clive Burr - drums Iron Maiden's o...

Triggered when user types !youtube

YouTube Search:

[15:43] <@Neo-Nemesis> !youtube Iron Maiden
[15:43] <@Boris_III> YouTube Search - About 105,000 results - http://www.youtube.com/results?search_query=Iron+Maiden&aq=f
[15:43] <@Boris_III> YouTube Official YouTube Channel Link http://www.youtube.com/user/ironmaiden?blend=1
[15:43] <@Boris_III> YouTube Iron Maiden Wasted Years Link: http://www.youtube.com/watch?v=SwB9zg7Tbx8
[15:43] <@Boris_III> YouTube Iron Maiden, ACDC and Guns N Roses 4 LIFE Link http://www.youtube.com/user/benoitiginla12?blend=3
[15:43] <@Boris_III> YouTube aces high Link: http://www.youtube.com/watch?v=4Sam5omG0v0

;YouTube Info 2.0
;By Neo Nemesis
on *:TEXT:*youtube*:#: {
  if ($1 == !youtube) { 
    %c.ytb = $chan
    YouTube search $2-
  }
  else {
    %c.ytb = $chan
    YouTube $1
  }
}
alias s.YTB.Parse {
  if (&amp; isin $remove($gettok($1-,2,32),href=",$chr(34))) { return $replace($remove($gettok($remove($1-,<h3>,<b>,</b>,</h3>),2,62),</a),&quot;,$chr(34),&#39;,$chr(39),&amp;,$chr(38)) 4Link15 http://www.youtube.com $+ $gettok($remove($gettok($1-,2,32),href=",$chr(34)),1,38) }
  else { return $replace($remove($gettok($remove($1-,<h3>,<b>,</b>,</h3>),2,62),</a),&quot;,$chr(34),&#39;,$chr(39),&amp;,$chr(38)) 4Link:15 http://www.youtube.com $+ $remove($gettok($1-,2,32),href=",$chr(34)) }
}
alias YouTube {
  if ($1 == search) {
    ;search
    unset %ysrc*
    sockclose s.ytb
    %ysrch = /results?search_query= $+ $replace($2-,$chr(32),$chr(43)) $+ &aq=f
    sockopen s.ytb www.youtube.com 80
  }
  else {
    unset %ytb*
    sockclose ytb
    %ytb1 = $remove($1,http://,www.,youtube,.com)
    sockopen ytb www.youtube.com 80
  }
}
on *:SOCKOPEN:s.ytb: {
  sockwrite -n $sockname GET %ysrch HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:s.ytb: {
  sockread %ysrc.1
  if (About <strong> isin %ysrc.1) { 
    .timerYTB6 1 1 msg %c.ytb 1,0You0,4Tube15,1 Search - $remove(%ysrc.1,<strong>,</strong>) - http://www.youtube.com $+ %ysrch
    %ysrc.3 = $true
  }
  if (dir="ltr" title=" isin %ysrc.1) && (%ysrc.3 == $true) {
    if (%ysrc.2) { inc %ysrc.2 }
    else { %ysrc.2 = 1 }
    if (%ysrc.2 <= 4) { .timerYTBb $+ %ysrc.2 1 $calc(%ysrc.2 + $rand(1,2)) msg %c.ytb 1,0You0,4Tube15,1 $s.YTB.Parse(%ysrc.1) }
    else { sockclose s.ytb } 
  }
}
on *:SOCKOPEN:ytb: {
  sockwrite -n $sockname GET %ytb1 HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf 
}
on *:SOCKREAD:ytb: {
  sockread %ytb2
  if (<meta name=" isin %ytb2) {
    if (="title" content=" isin %ytb2) { 
      %ytb.title = $remove(%ytb2,<meta name="title" content=",">) 
      .timerYTB1 1 1 msg %c.ytb 1,0You0,4Tube15,1 Title: $replace(%ytb.title,&#39;,$chr(39),&quot;,$chr(34),&amp;,$chr(38)) $+ 
    }
    if (="description" content=" isin %ytb2) { 
      %ytb.desc = $remove(%ytb2,<meta name="description" content=",">)
      .timerYTB2 1 2 msg %c.ytb 1,0You0,4Tube15,1 Info: $replace(%ytb.desc,&#39;,$chr(39),&quot;,$chr(34),&amp;,$chr(38)) $+ 
    }
    if (%ytb.title) && (%ytb.desc) { sockclose ytb }
  }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...