יוצר: לא ידוע
תיאור: הקוד נותן אינפורמציה לגבי סרטון מהאתר youtube
הפעלה: רושמים בערוץ את הלינק לסרטון
תמונה:
קוד: בחר הכל
on *:text:*:#: {
if (*http://*youtube.com/watch?v=* iswm $1-) {
set %you.slink $strip($wildtok($1-,*http://*youtube.com/watch?v=*,1,32))
tokenize 47 %you.slink
set %you.link $3
set %you.chan $chan
youtube %you.link $chan
}
elseif (*http://www.youtube.com/user/*#p/a/*/*/* iswm $1-) {
set %you.slink $strip($wildtok($1-,*http://www.youtube.com/user/*#p/a/*/*/*,1,32))
tokenize 47 %you.slink
set %you.chan $chan
set %you.link $8
youtube %you.link $chan
}
elseif (*http://*youtu.be* iswm $1-) {
set %you.slink $strip($wildtok($1-,*http://*youtu.be*,1,32))
tokenize 47 %you.slink
set %you.chan $chan
set %you.link $3
youtube %you.link $chan
}
}
alias youtube {
if ($2) set %you.chan $2
else %you.chan = $active
%you.lookup = $1
%you.vid = $remove(%you.lookup,http://,www.youtube.com/,watch?v=,youtu.be/)
if ($sock(YouTube)) .sockclose YouTube
sockopen YouTube ipeer.net63.net 80
}
on *:SOCKOPEN:YouTube: {
sockwrite -nt $sockname GET $+(/php/yt.php?vid=,%you.vid) HTTP/1.1
sockwrite -nt $sockname Host: ipeer.net63.net
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:YouTube: {
if ($sockerr) {
echo -t %you.chan Socket Error: $sockname $+ . Error code: $sockerr.
halt
}
else {
var %sockreader
sockread %sockreader
if (ERROR:* iswm %sockreader) {
echo -t %you.chan $ytc1(Error getting video info:) $ytc2($gettok(%sockreader,2-,32))
unset %you.*
sockclose $sockname
}
elseif (*|*|*|*|*|* iswm %sockreader) {
%you.title = $gettok(%sockreader,1,124)
%you.from = $gettok(%sockreader,2,124)
%you.len = $gettok(%sockreader,3,124)
%you.views = $gettok(%sockreader,4,124)
%you.added = $gettok(%sockreader,5,124)
%you.desc = $gettok(%sockreader,6,124)
%you.ratings = $gettok(%sockreader,7,124)
/msg %you.chan [1,0You0,4Tube]: Title: %you.title
.timer 1 1 /msg %you.chan [1,0You0,4Tube]: Author: %you.from Views: %you.views Added: %you.added Duration: $iif(%you.len,$duration($v1,3),??)
}
}
}
alias -l nohtml { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x }