simple little code to get the youtube title and url of the video you are currently watching. it has a check in it so that it will only work with youtube urls. All you need to do is type /yt in any channel or query and it will display it for you
Thanks to Obi-Wan for the original idea
UPDATE 4/9/2013
cleaned up the output on this a bit
UPDATE 2/25/12
updated the script a bit to improve the url parse enjoy !
alias yt {
if (($dde(opera,WWW_GetWindowInfo)) || ($dde(firefox,WWW_GetWindowInfo)) || ($dde(netscape6,WWW_GetWindowInfo)) || ($dde(iexplore,WWW_GetWindowInfo,1))) {
if ($regex(url,$v1,/^"([^"]+)"\x2C"([^"]*)"(?:\x2C".*")?$/)) {
var %parse = $+($regml(url,1)),$+(",$regml(url,1),") | var %parse2 = $+($regml(url,2)),$+(",$regml(url,2),")
if ($regex(%parse,(youtube\.com)\/.*v=([^&]+))) {
describe $active is watching: 1,0You0,4Tube $remove(%parse2,- youtube) @ $+(http://youtu.be/,$regml(2))
}
else { echo -a *Error* Not A 1,0You0,4Tube Link. }
}
else { echo -a *Error* Browser Not Found or Unknown. }
}
}
thanks guys for the feedback its much appreciated.
@ napa182 yea i suppose it could be either or. i usually have a playlist going in the background of music so technically im not watching it. And yes this is a differant script that i adapted to show only youtube info. it was originally a generalized webpage Title getter for irc, it would be used to get the page title for any page u were viewing.
@ sunslayer ty for the regex line i will try to incorporate it into the next version.
@ henbone11 ive noticed an error on some of the newer pages of youtube where it is returning an error. yes they have made some site changes so im going to have to take a look at it again to see what can be done. there is also an error if the title has parentese in it eg: limp bizkit - "break stuff" it wont return a result. i will try and fix all of this in the next version