YouTube 发送实时聊天消息不起作用
YouTube send live chat message does not work
youtube.liveChatMessages().insert
returns 错误代码 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)
Error response received.
我很确定 authorDetails
资源是从 API 返回的字典,其中提供了有关聊天消息作者的详细信息。它仅从 GET 请求返回,永远不应添加为 POST 或 PUT 请求的参数,因为此数据无法更改。
youtube.liveChatMessages().insert
returns 错误代码 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)
Error response received.
我很确定 authorDetails
资源是从 API 返回的字典,其中提供了有关聊天消息作者的详细信息。它仅从 GET 请求返回,永远不应添加为 POST 或 PUT 请求的参数,因为此数据无法更改。