Youtube Live Streaming API liveChatNotFound

问题描述 投票:2回答:1

我试图找到一种方法来从流中获取所有消息,我已经如此接近,但后来我得到一个错误。由于某种原因,我使用的视频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."
 }
}
youtube-api google-apis-explorer youtube-livestreaming-api youtube-data-api
1个回答
1
投票

传递您的视频ID为下面的api并获得实际的聊天ID

获取livechat id(用你的api密钥替换)

https://www.googleapis.com/youtube/v3/videos?id=kpfV38Hcnds&key=AIzaxxxxxxxxxxxxxxxxdQShvisQW_kdY0Yxxx&part=liveStreamingDetails

在回复中你会找到livechatid,将这个实时聊天ID传递给下面的api

获取所有聊天记录(替换为您的api密钥)

https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=Cg0KC2twZlYzOEhjbmRz&part=snippet&key=AIzaxxxxxxxxxxxxxxxxdQShvisQW_kdY0Yxxx

© www.soinside.com 2019 - 2024. All rights reserved.