YouTube Sockread Script für mIRC

Dieses mIRC MSL Script ruft bei jeder YouTube Video URL (youtube.com -.de -youtu.be -moone.in), die in einem IRC Kanal gepostet wird die Infos ab und gibt diese im entsprechenden IRC Channel aus. Einfach in mIRC "alt + r" drücken und den Code aus der Box einfügen, speichern und dann jemand anderen ein Video posten lassen.

;YouTube Info 1.3

;Originally by Neo Nemesis updated by Lightningsoul.com

alias youtube {

%ytube1 = $remove($1,http://,www.,youtube,.com)

sockopen youtube www.youtube.com 80

}

alias youtube2 {

%ytube1 = $remove($1,http://,www.,moone,.in/)

%ytube1 = /watch $+ %ytube1

sockopen youtube www.youtube.com 80

}

alias youtube3 {

%ytube1 = $remove($1,http://,youtu,.be/)

%ytube1 = /watch?v= $+ %ytube1

sockopen youtube www.youtube.com 80

}

on *:SOCKOPEN:youtube: {

sockwrite -n $sockname GET %ytube1 HTTP/1.1

sockwrite -n $sockname Host: www.youtube.com

sockwrite -n $sockname Connection: Keep-Alive

sockwrite -n $sockname Content-Type: text/html

sockwrite -n $sockname $crlf

}

on *:SOCKREAD:youtube: {

sockread %ytube2

if (%ytube2 == $null) && (%sockread == $null) {

msg %ytube3 1,0You0,4Tube15,1 Error receiving information.

set %sockread 1

}

elseif (%ytube2 == $null) && (%sockread != $null) { noop }

elseif (meta name="title" content=" isin %ytube2) {

%endtitle = $pos(%ytube2,/title>,1)

%starttitle = $pos(%ytube2,title>,1)

%inbetween = $calc(%endtitle - %starttitle)

if (%shitstop == 0) msg %ytube3 0,6moone11,1in 15,1 %moonelink 

msg %ytube3 %ymoon 15,1 $htmlconv($mid(%ytube2,$calc(%starttitle + 6),$calc(%inbetween -16)))

}

}

on *:TEXT:*youtube*:#: {

%ytube3 = $chan

%ytube4 = 1

%ymoon = 1,0You0,4Tube

while ([ $chr(36) $+ [ %ytube4 ] ]) {

if (www.youtube.com/watch isin [ $chr(36) $+ [ %ytube4 ] ]) {

sockclose youtube

%clearurl = $replace($1,https,http)

youtube %clearurl

%ytlink = $gettok($1-,%ytube4,32)

%moonelink = $replace(%clearurl,www.youtube.com/watch,moone.in/)

%shitstop = 0

}

inc %ytube4

}

}

on *:TEXT:*moone.in*:#: {

%ytube3 = $chan

%ytube4 = 1

%ymoon = 0,6moone11,1in

while ([ $chr(36) $+ [ %ytube4 ] ]) {

if (moone.in/?v= isin [ $chr(36) $+ [ %ytube4 ] ]) {

sockclose youtube

youtube2 [ $chr(36) $+ [ %ytube4 ] ]

%shitstop = 1

}

inc %ytube4

}

}

on *:TEXT:*youtu.be*:#: {

%ytube3 = $chan

%ytube4 = 1

%ymoon = 1,0You0,4Tube

while ([ $chr(36) $+ [ %ytube4 ] ]) {

if (youtu.be/ isin [ $chr(36) $+ [ %ytube4 ] ]) {

sockclose youtube

youtube3 [ $chr(36) $+ [ %ytube4 ] ]

%ytlink = $gettok($1-,%ytube4,32)

%moonelink = $replace(%ytlink,youtu.be/,moone.in/?v=)

%shitstop = 0

}

inc %ytube4

}

}

Ja, ich bin stolz auf die dummen Variablen und die miserable Formatierung. 

Dankeschön auch nochmal an Kati, #help.script (Quakenet) und Neo Nemesis für die Hilfe bei der Programmierung bzw. die Vorarbeit!

comments powered by Disqus