YouTube Song Advertiser

By rebel9 on Jan 11, 2016

As long as youtube.com is your active tab on your browser, this will display the song you are playing.I can't take all the credit for this, half of this work goes to someone else on hawkee. I just made it work for all links, as far as I can tell. Feel free to improve this script.
Add this script to remotes. Tools -> Scripts Editor -> Remotes tab -> C/P script -> File -> Save -> Ok.

Usage: /yt
Credits: Hawkee / rebel irc.internetz.me+6697 #main

alias yt {
  var %i 1
  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=([^&]+))) {
      if ($regex(%parse,(https:\/\/.*youtube.*\/watch\?v=(.{11})&?.*))) {
        say 14♪ You4Tube  14(Title14)  $replace($remove(%parse2,- youtube)$1,$chr(95),$chr(32)) 14(Link14) $+(,http://youtu.be/,$regml(2),) 14♪ 
      }
      else { echo -a Not a YouTube link. }
    }
    else { var %r1 = $dde(firefox,WWW_GetWindowInfo) | var %link = $gettok(%r1,1,38) | var %id = $gettok(%link,2,61) | var %title = $gettok(%r1,2-,44) | say 14♪ You4Tube 14(Title14) $remove(%title,- Youtube,\,",$chr(44),index=,list=WL) 14(Link14) $remove(%link,",$chr(44))   14♪ $chr(32)  }  
  }
}

Comments

Sign in to comment.
dma   -  Jan 11, 2016

good one

^WeSt  -  Mar 14, 2016

Clever method!!

Sign in to comment

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.