我正在尝试检索从实时流式传输中获得的所有聊天消息,该流式传输已经结束。但是使用下面的请求,它不会检索任何snippet.liveChatId,如Google文档中所述:https://developers.google.com/youtube/v3/live/docs/liveBroadcasts#snippet.liveChatId
如果我尝试即将进行的流式传输,则可以正常运行。
如果无法获得适当的liveChatId,在这种情况下如何获取聊天消息?
一些值替换为MY_XPTO
请求:

    GET https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&id=MY_ID&key=[YOUR_API_KEY] HTTP/1.1

    Authorization: Bearer [YOUR_ACCESS_TOKEN]
    Accept: application/json
响应:
    {
     "kind": "youtube#liveBroadcastListResponse",
     "etag": "MY_ETAG",
     "pageInfo": {
      "totalResults": 0,
      "resultsPerPage": 5
     },
     "items": [
      {
       "kind": "youtube#liveBroadcast",
       "etag": "MY_ETAG,
       "id": "MY_ID",
       "snippet": {
        "publishedAt": "2020-04-03T21:23:06.000Z",
        "channelId": "MY_CHANNEL_ID",
        "title": "MY_TITLE",
        "description": "MY_DESCRIPTION",
        "thumbnails": {
         "default": {
          "url": "MYURL",
          "width": 120,
          "height": 90
         },
         "medium": {
          "url": "MY_URL",
          "width": 320,
          "height": 180
         },
         "high": {
          "url": "MY_URL",
          "width": 480,
          "height": 360
         },
         "standard": {
          "url": "MY_URL",
          "width": 640,
          "height": 480
         },
         "maxres": {
          "url": "MY_URL",
          "width": 1280,
          "height": 720
         }
        },
        "scheduledStartTime": "2020-04-07T20:00:00.000Z",
        "actualStartTime": "2020-04-07T20:01:00.326Z",
        "actualEndTime": "2020-04-07T21:43:52.000Z",
        "isDefaultBroadcast": false
       }
      }
     ]
    }

最佳答案

The documentation指出:

强调我的。
这意味着YouTube完成后会销毁liveChatId(更确切地说,流结束后约400秒,或首映结束后约60秒),因此通过合法方式获取liveChatId是不可能的。而且,即使您设法获得该ID,您也将无法使用该ID来修改以前的直播的聊天记录。

08-19 13:05