使用YouTube v3 API更新标题和说明? [英] Update title and description using YouTube v3 API?
问题描述
我已成功使用 YouTube数据API v3 将视频上传到YouTube。没有使用第三方库。现在我想更新已上传视频的标题和说明,但这似乎不可能!
I successfully uploaded a video to YouTube using YouTube Data API v3. No third party libraries were used. Now I want to update the title and description of an uploaded video, but this seems impossible!
这应该是一个没有脑子的,但YouTube拒绝接受这个简单的查询:
This should be a no-brainer, but YouTube refuses to accept this simple query:
curl --insecure -v -i -X PUT -HContent-Type:application / json-H授权:承载ACCESS_TOKEN_FROM_GOOGLE_HERE-d'{id:YOUTUBE_VIDEO_ID_HERE,snippet:{ title:我的标题,description:我的说明,categoryId:22}}https://www.googleapis.com/youtube/v3/videos?part=snippet
即使我无法确定视频是否存在,YouTube服务器会以此回复:
Even though I'm dead sure that the video does exist YouTube server responds with this:
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "videoNotFound",
"message": "The video that you are trying to update cannot be found. Check t
he value of the \u003ccode\u003eid\u003c/code\u003e field in the request body to
ensure that it is correct.",
"locationType": "other",
"location": "body.id"
}
],
"code": 404,
"message": "The video that you are trying to update cannot be found. Check the
value of the \u003ccode\u003eid\u003c/code\u003e field in the request body to e
nsure that it is correct."
}
}
有人可以向我显示低级命令第三方库)以成功更新上传视频的标题和说明。最好使用 curl 。
我可以使用删除文件
I am able to delete the file using the delete API. Hence, the ID is indeed correct.
推荐答案
不知道为什么,但如果我包括整个 json
从实际上传的响应,它的工作原理。更新描述我做以下:
- Upload video.
- Wait for response.
- Parse json response and replace description text.
- Update video with new json.
- 上传视频。
- 等待回应。
- 解析json回应并替换说明文字。
- 使用新的json更新视频。
Hence, updating using a stripped down json does not seem to work.
这篇关于使用YouTube v3 API更新标题和说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!