So, this used to work. Now, not so much...


Code:
on *:TEXT:!songrequest &:#ifstudios:{
  noop $regex($2,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
  if $read(songrequest.txt,nw,$+(*,$2)) { 
    msg # The Song $gettok($v1,2-,32) is already on my list :)
  }
  elseif !$regml(2) {
    msg # $nick --> You typed invalid youtube url.
  }
  else {
    youtube $2 $chan $nick
  }
}

alias -l sockopenmark { sockopen $1-3 | sockmark $1 $4- }
alias -l youtube {
  noop $regex($1,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
  sockopenmark $+(yt.,$calc($ticks + $rand(1,99))) www.youtube.com 80 $regml(2) msg $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.*:{
  tokenize 32 $sock($sockname).mark
  var %v | sockread %v
  if ($regex(%v,/"name" content="(.+)"/)) { 
    var %song $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38)) $5-
    $2-3 The Song %song has been added to my playlist 
    write songrequest.txt $4 $+ : %song $+ : https://www.youtube.com/watch?v= $+ $1
    sockclose $sockname
  }
  elseif *</html> iswm %v { $2-3 The Song ( https://www.youtube.com/watch?v= $+ $1 ) is not exists. }
}





For example...



Me:!songrequest www.youtube.com/watch?v=XbGs_qK2PQA
(nothing returned. At all.)

----

Me:!songrequest watch?v=XbGs_qK2PQA
Bot: username --> You typed an invalid youtube url




Any clues as to why it's not working correctly?