YouTube Now Playing

By TehJibba on Mar 29, 2010

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) @ $+(,$regml(2)) 
      else { echo -a *Error* Not A 1,0You0,4Tube Link. }
    else { echo -a *Error* Browser Not Found or Unknown. }  


Sign in to comment.
Twitchy88   -  Aug 19, 2012

nice script i dont get the title though just the link. only change was made was i replace the word firefox with the name pale moon as i use that instead of FF

Skywalker   -  Aug 24, 2011

this does not work if you have more tabs open in the webbrowser

sunslayer   -  Jan 24, 2011

@BiohazardGR, chrome doesn't support DDE

BiohazardGR   -  Jan 24, 2011

for google chrome what do i do?

kylethegeek   -  Oct 17, 2010

It needs a Google Chrome one

TehJibba   -  May 22, 2010

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

sunslayer   -  Apr 02, 2010

@henbone11 this site only looks at the url, not the source and this works fine for me(on firefox anyways)

henbone11   -  Apr 01, 2010

did something on the youtube site get changed? it returns nothing any more but an error. I have seen similar results from another bot that does the same thing.

Jethro   -  Mar 30, 2010

Nice one, Sunslayer. I fancy the use of regex octal numbers. :p

sunslayer   -  Mar 29, 2010

you can also simplify your regex into one statement with

/^\42http:\/\/www\56youtube\56com\/watch\77v=([^\W]*)(?:\46NR=1)?\42\x2C\42YouTube \55 (.+)\42\x2C\42.*\42$/i
napa182   -  Mar 29, 2010

Is Listening To:

um wouldn't it be " Is Watching " ?

to me it looks like you slapped this together from some other code tbh..

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.