Make sure to close the socket if it's still open.
alias youtube {
sockclose ytube
sockopen -e ytube www.googleapis.com 443
}
on *:sockopen:ytube:{
if ($sockerr) {
sockclose $sockname
echo -ag err
halt
}
sockwrite -n $sockname GET /youtube/v3/playlistItems?part=id&playlistId=<playlist ID Here>&key=<api key here> HTTP/1.0
sockwrite -n $sockname Host: www.googleapis.com
sockwrite -n $sockname $crlf
echo -tag socket write
}
on *:sockread:ytube:{
if ($sockerr) { return }
var %read | sockread -f %read
while ($sockbr) {
if (%read != $null) echo -ag %read
sockread -f %read
}
}
I used this exact script and he response was printed. I think you may also want to request HTTP/1.0 instead of 1.1 so you don't need to support chunked transfer encoding.