使用YouTube v3 API更新标题和说明? [英] Update title and description using YouTube v3 API?

查看:420
本文介绍了使用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 从实际上传的响应,它的工作原理。更新描述我做以下:

  1. Upload video.
  2. Wait for response.
  3. Parse json response and replace description text.
  4. Update video with new json.

  1. 上传视频。

  2. 等待回应。

  3. 解析json回应并替换说明文字。

  4. 使用新的json更新视频。

Hence, updating using a stripped down json does not seem to work.

这篇关于使用YouTube v3 API更新标题和说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆