I am trying to find a way to get all of the messages from a stream and I've gotten so close but then I get an error. For some reason the video ID that I use isn't valid even though it is valid. Maybe I'm getting the wrong id? Here is the XMLHttpRequest:
https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=hHW1oY26kxQ&part=snippet&key={API-KEY}&maxResults=2000
Here is the response:
{
"error": {
"errors": [
{
"domain": "youtube.liveChat",
"reason": "liveChatNotFound",
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests \u003ccode\u003eliveChatId\u003c/code\u003e parameter to ensure that it is correct."
}
],
"code": 404,
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests \u003ccode\u003eliveChatId\u003c/code\u003e parameter to ensure that it is correct."
}
}
pass your video id for the below api and get the actual livechat id
get livechat id (replace with your api key )
in the response u will find the livechatid ,pass this live chat id to the below api
get all the chats(replace with your api key )