Yet Another Youtube Title grabber
Platform: mIRC
Published Feb 24, 2012
Updated Feb 27, 2012
just a simple channel and pm youtube title grabber. just paste this in your remotes and any youtube url will be parsed for its title.
*** I realize there is a huge replace line in the script. if anyone can suggest an easier or better way to replace html ascii or a better way of going about this i welcome your comments. The script is still functional and nearly instant. Ive been getting same second replies.
Tested and added ProIcons line to it. good call on the shortlink catcher
****This is meant to be put on a bot. when someone posts a youtube link either in the channel or in pm it will grab the title @ EminamaDron
****UPDATE 2/27/2012****
Ok so to start credits to MakiMaki for the no var's version posted. After extensive testing and reworking this is the finalized version. A major thanks goes to my m8 ex0a for an improved regex and alias to eliminate the need for a loop.
This new version will now properly grab any number of youtube url's posted in the channel or pm no matter how fast they are posted and will return the title for each one with a youtube shorturl for each as well. I would highly recommend putting a spam protection on it.
;-------------------------------------------;
; Youtube Title Grabber ;
;-------------------------------------------;
alias -l sockopenmark { sockopen $1-3 | sockmark $1 $4- }
on $*:text:/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si:*: {
sockopenmark $+(yt.,$calc($ticks + $rand(1,99))) www.youtube.com 80 $regml(2) msg $iif($chan,$v1,$nick) $+($chr(02),$chr(03),01,$chr(44),00,You,$chr(3),00,$chr(44),04,Tube,$chr(3)) $+($chr(02),@,$chr(32),$chr(31),http://youtu.be/,$regml(2))
}
on *:sockopen:yt.*:{
tokenize 32 $sock($sockname).mark
sockwrite -n $sockname GET /watch?v= $+ $1 HTTP/1.0
sockwrite -n $sockname HOST: www.youtube.com $+ $str($crlf,2)
}
on *:sockread:yt.*:{
var %v | sockread %v
if ($regex(%v,/"name" content="(.+)"/)) {
tokenize 32 $sock($sockname).mark
$2-4 $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38)) $5-
sockclose $sockname
}
}