【问题标题】:How to Like Youtube Video with Youtube Api v3 using php如何使用 php 使用 Youtube Api v3 喜欢 Youtube 视频
【发布时间】:2012-12-09 06:41:27
【问题描述】:

由于 Youtube Api V2 不再支持特定视频。谁能解释一下如何用 youtube api v3 点赞视频? 我总是收到以下回复:

 Response


400 Bad Request

- Show headers -

{
 "error": {
  "errors": [
   {
    "domain": "youtube.part",
    "reason": "unexpectedPart",
    "message": "contentDetails",
    "locationType": "parameter",
    "location": "part"
   }
  ],
  "code": 400,
  "message": "contentDetails"
 }
}

请求是:

Request


POST https://www.googleapis.com/youtube/v3/activities?part=snippet&key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.AHES6ZQUI8Gn7j93QZBmmdlDe7Ei-iqYseYAKAxyf3qTOHHwDHb-dA
X-JavaScript-User-Agent:  Google APIs Explorer

{
 "contentDetails": {
  "like": {
   "resourceId": {
    "videoId": "video-id",
    "kind": "youtube#video"
   }
  }
 }
}

部分是=sn-p

我正在关注这些文档:https://developers.google.com/youtube/v3/docs/activities/insert

【问题讨论】:

标签: php youtube youtube-api


【解决方案1】:

答案已经在 cmets 中,但要稍微提升一下:YouTube API v3: Liking a video in Python 有更多关于喜欢视频的信息,尽管示例是 Python 中的。

重要的是,喜欢视频是通过playlistItems.insert() 调用完成的,而不是activities.insert() 调用。这是一个常见的混淆来源,我已经要求我们的技术作家尝试在文档中澄清问题。

【讨论】:

    猜你喜欢
    • 2013-09-22
    • 1970-01-01
    • 1970-01-01
    • 2012-01-14
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    相关资源
    最近更新 更多