'Retrieiving YouTube chat data from archived (completed) livestream

I am trying to figure out how to obtain the chat messages along with their details using the YouTube data API v3. I am able to obtain chat data while the stream is live, but this is about getting the replay chat after the fact.

This type of thing is done by tools such as Chat Replay Downloader, but there are a few drawbacks with that, such as the inability to see the chats for any stream marked Private (since chat_replay_downloader doesn't utilize a signed-in Google account). I'd like to incorporate this into a process I already have running, that identifies all livestreams and stores information about them into a mySql database. In that data is a liveChatId variable that does point to the chat, but the only use I seem to be able to make of that, is to use LiveChatMessages: list, which only works with currently-live streams. Attempts to use a completed Chat ID with LiveChatMessages:List, receive a 403 error:

{
  "error": {
    "code": 403,
    "message": "The live chat is no longer live.",
    "errors": [
      {
        "message": "The live chat is no longer live.",
        "domain": "youtube.liveChat",
        "reason": "liveChatEnded"
      }
    ]
  }
}

I've also been able to list the signed-in channel's videos, including "archived" livestreams, but I don't see a means of obtaining or addressing the chats from there, and I don't see an endpoint for such retrieval. I thought it might somehow be related to comments, but that seems to be a dry river as well.

This Stack Overflow question was similar and includes an interesting link that surprised me, but not really anything that will point me in the right direction with this question.

I'm really surprised there are not a lot of questions on this. Maybe it's just me having this brain block, since I couldn't find much else about archived (<-- as YouTube calls them) livestreams. Any help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source