Lol, this is exactly the script I've been working on the past couple of weeks. This first part of the script looks up the song and writes it down on the ini file. I did update this but since I'm typing it on my laptop I can't access my new script. I'll post it once I get home.

Code:
on *:TEXT:!songrequest &:#: { 
  if ($sock(YTube)) .sockclose YTube
  if (*www.youtube.com* iswm $2) {
    set %y_l $right($2,11)
  }
  else {
    set %y_l $2
  }
  if ($ini(songrequest.ini,%y_l,0) == 1) {
    msg # This song is already in my playlist. 
    unset %y_l
  }
  else {
    set %y_d 1
    set %y_n $nick
    set %y_newb $chan
    sockopen -e YTube gdata.youtube.com 443
  }
}

on *:SOCKOPEN:YTube: {
  sockwrite -nt $sockname GET /feeds/api/videos/ $+ %y_l HTTP/1.1
  sockwrite -nt $sockname Host: gdata.youtube.com $+ $str($crlf,2)
}

on *:SOCKREAD:YTube: {
  if (!$sockerr) {
    var %sockreader | sockread %sockreader
    if (*duration='*'* iswm %sockreader) {
      set %y_len $gettok(%sockreader,46,39)
      if (%y_len > 240) { 
        msg %y_newb Videos cannot be longer than 4 minutes. 
        unset %y_*
      }
      else {
        writeini -n Dinocoins.ini $+(%y_newb,.,%y_n) dinocoins $calc($readini(Dinocoins.ini,$+(%y_newb,.,%y_n),dinocoins) - %y_d)
        writeini songrequest.ini %y_l %y_len %y_n
        msg %y_newb Your song has been added, you now have $readini(Dinocoins.ini,$+(%y_newb,.,%y_n),dinocoins) $+ . 
        unset %y_*
      }
    }
  }
  else {
    msg %y_newb There was an error
    unset y_*
  }
}


Note: In my stream I use dinocoins in order for people to ask for a song. Feel free to remove it!

This script looks up the songrequest by typing !songrequest. You can type in the full look E.G. https://www.youtube.com/watch?v=xxxxxxxxxxx or you can just type the ending bit of the link xxxxxxxxxxxx. You will have to accept a little notice that comes up since this uses g.data.youtube.com instead of the regular youtube html.

Here's the second part of the script I've been using.

Code:

alias -l playYT {
if (%playing == 1)
  var %file songrequest.ini
  if (!$ini(%file,0)) {
     var %number $rand(1,N)
     var %song $ini(newbieplaylist.ini,%number)
     run -n www.youtube.com/watch?v= $+ %song
     var %timer $calc($ini(newbieplaylist.ini,%song,1) + 7)
    .timerplayYT 1 %timer playYT
  }
  ; -----------------------------------------
  var %song $ini(%file,1)
  run -n www.youtube.com/watch?v= $+ %song
  var %timer $calc($ini(%file,%song,1) + 5)
  remini %file %song
  .timerplayYT 1 %timer playYT
}

on *:TEXT:!play &:#: {
  if ($2 == start) {
    set %play 1
    playYT
  }
  elseif ($2 == stop) {
    unset %playing
  }
}


Note: This will open up new tabs so it will be up to you to close the tabs.

When a mod or the channel owner types !play start it starts playing a song from a list of songrequest which you will get from the previous script. To stop the script simply type !play stop. It will finish the currently running song and then stop. Now this is something that can be removed but this script runs a seperate playlist in case there is no songs in the songrequest list. So if no one puts a song down then it will go to newbieplaylist.ini which you can remove. If you want to keep it, change N to the number of songs you have on your personal playlist.

Oh and also this will make the browse window the main window so if you're playing a game just click back on it. Trying to get this fixed.

Last edited by Newbie; 11/02/15 02:30 PM.