【问题标题】:YouTube send live chat message does not workYouTube 发送实时聊天消息不起作用
【发布时间】:2016-08-24 04:48:55
【问题描述】:

youtube.liveChatMessages().insert 返回 400 错误代码,原因是 unexpectedPart

这是在 Google API 浏览器上收到的相同回复。

def send_message(youtube):
  send_message_response = youtube.liveChatMessages().insert (
     part = "snippet",
     body = dict (
        snippet = dict(
           liveChatId = result_chatId,
           type = "textMessageEvent",
           textMessageDetails = dict(
               messageText = "hello world"
           )
         ),
         authorDetails = dict(
             displayName = "blabla"
         )
      )
   ).execute()

   print "%s" % (send_message_response)

收到错误响应。

【问题讨论】:

    标签: python youtube youtube-api youtube-livestreaming-api


    【解决方案1】:

    我很确定 authorDetails 资源是从 API 返回的字典,其中提供了有关聊天消息作者的详细信息。它仅从 GET 请求返回,绝不应作为参数添加到 POST 或 PUT 请求中,因为无法更改此数据。

    【讨论】:

      猜你喜欢
      • 2019-07-29
      • 1970-01-01
      • 1970-01-01
      • 2020-10-10
      • 2018-03-10
      • 2014-01-31
      • 2021-04-14
      • 2016-04-13
      • 2014-07-26
      相关资源
      最近更新 更多