【问题标题】:Youtube Live Streaming API liveChatNotFoundYoutube 直播 API liveChatNotFound
【发布时间】:2019-04-20 18:35:22
【问题描述】:

我正在尝试找到一种方法来从流中获取所有消息,而且我已经非常接近了,但随后出现错误。出于某种原因,我使用的视频 ID 无效,即使它 有效。也许我得到了错误的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】:

    为下面的 api 传递你的 video id 并获取实际的 livechat 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

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 2017-07-31
      • 2016-04-20
      • 2016-10-23
      • 2015-01-11
      • 2013-09-22
      • 2020-03-17
      • 2016-05-22
      • 2014-03-28
      相关资源
      最近更新 更多