So I have a script, and am trying to access the youtube API through sockets. Endgame goal: add a youtube video to a youtube playlist. so far I can store the youtube video ID, but just need to figure out how to add that ID to a playlist through the youtube API. I was able to do this through google's "try it feature" at the bottom of this page: https://developers.google.com/youtube/v3/docs/playlistItems/insert but when I try to access the API through mIRC script, it seems like nothing happens.


Code:
alias youtube {
  sockopen ytube www.googleapis.com 443
}

on *:sockopen:ytube:{
  if ($sockerr) { 
    sockclose $sockname
    halt 
  }
  sockwrite -n $sockname GET /youtube/v3/playlistItems?part=id&playlistId=<playlist ID Here>&key=<api key here> HTTP/1.1
  sockwrite -n $sockname Host: www.googleapis.com $crlf $+ $crlf
  
  echo -tag socket write
}

on *:sockread:ytube:{
  if ($sockerr) {
    sockclose $sockname 
    halt
  }
  ;This is where I have tried reading the socket, seeing what was being read, even just msg # read sockets. Nothing happens.
}

Obviously, I removed my playlist ID, and API key, but I know they are good, because When I go to the api url in my browser, it pulls up the playlist and all, so I know the url is good as well as the API key I am using.



So like I said, nothing seems to happen after the sockets are opened. Am I doing it wrong?




This is what it looks like when I pull it up in my browser:
Code:
{
 "kind": "youtube#playlistItemListResponse",
 "etag": "\"jSSWBfHLqA4YDVcP7dOWTvijbRo/C5H7H2Kp11az9zUYXUUF1rICsA8\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 5
 },
 "items": [
  {
   "kind": "youtube#playlistItem",
   "etag": "\"jSSWBfHLqA4YDVcP7dOWTvijbRo/YW4O1EVPAaOqaFMFKk8Q2EYA8uM\"",
   "id": "PLcsh5-UPddz_PFHkGNTxkhs3RilAMb3U09YGFOwlOfMg"
  }
 ]
}




Looking for suggestions... To actually add a video to the playlist, I know I will need to use POST instead of GET, but I am just trying to verify that I can even connect and read info, which doesn't seem to be working.