我试图找到一种方法来从流中获取所有消息,我已经如此接近,但后来我得到一个错误。由于某种原因,我使用的视频ID即使有效也无效。也许我得错了身份证?这是XMLHttpRequest:
https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=hHW1oY26kxQ&part=snippet&key={API-KEY}&maxResults=2000
以下是回复:
{
"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."
}
}
传递您的视频ID为下面的api并获得实际的聊天ID
获取livechat id(用你的api密钥替换)
在回复中你会找到livechatid,将这个实时聊天ID传递给下面的api
获取所有聊天记录(替换为您的api密钥)