YouTube Script 2.0
Platform: mIRC
Published Sep 24, 2010
Updated Apr 24, 2011
Intended 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....
Quote
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 <search info>
;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 (& isin $remove($gettok($1-,2,32),href=",$chr(34))) { return $replace($remove($gettok($remove($1-,<h3>,<b>,</b>,</h3>),2,62),</a),",$chr(34),',$chr(39),&,$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),",$chr(34),',$chr(39),&,$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,',$chr(39),",$chr(34),&,$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,',$chr(39),",$chr(34),&,$chr(38)) $+
}
if (%ytb.title) && (%ytb.desc) { sockclose ytb }
}
}