I'm trying to get metadata of youtube links echoed beneath them when they're posted.

Code:
Alias youtube {
  sockClose youtube
  sockOpen youtube gdata.youtube.com 80
}

on *:SockOpen:youtube.*: {
  sockwrite -nt $sockname GET /feeds/api/videos/oqT14k6BsC0 HTTP/1.1
  sockwrite -nt $sockname Host: gdata.youtube.com
  sockwrite -nt $sockname User-Agent: mIRC Script
  ; sockwrite -nt $sockname Cache-Control: no-cache
  sockwrite -nt $sockname Accept-Encoding: gzip
  sockwrite -nt $sockname $crlf
}

on *:SockRead:youtube.*: {
  var %read
  sockRead %read
  echo -a zzzzzzzzzzzzz %read
}


For the majority of youtube links, this code works fine. However, every now and then, the sockread messes up and inserts random characters for no reason (as far as I can see).

For example, for the video ID oqT14k6BsC0, I get

Code:
blahblahblah...<media:title type='plain'>League of Legends - Spectator Mode</media:title><yt:duration seconds='277'/></media:group><gd:rating averag
zzzzzzzzzzzzz 9d
zzzzzzzzzzzzz e='4.924626' max='5' min='1' numRaters='9287'...blahblahblah


If you look at the link: http://gdata.youtube.com/feeds/api/videos/oqT14k6BsC0

You can see that "9d" never appears. Where did that come from? Why is it on its own line? How do I get rid of it? They occur in places that mess up my parsing of the XML. In the code above for example, it prevents me from getting the "rating" of the video since the tag head and the value are on different lines.

Thanks very much!