doujia7162 2012-12-21 17:05
浏览 30

如何用Youtube Api v3使用php喜欢Youtube视频

Since Youtube Api V2 doesn't support like a specific video anymore. Can anyone please explain how to like a video with youtube api v3 ? I am always getting the following response:

 Response


400 Bad Request

- Show headers -

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

The request is :

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"
   }
  }
 }
}

The part is = snippet

I am following these docs : https://developers.google.com/youtube/v3/docs/activities/insert

  • 写回答

1条回答 默认 最新

  • doubei8541 2012-12-28 16:39
    关注

    The answer is already in the comments, but to elevate it a bit: YouTube API v3: Liking a video in Python has more information about liking a video, though the example there is in Python.

    The important part is that liking a video is done via a playlistItems.insert() call, not an activities.insert() call. This is a common source of confusion and I've already asked our tech writer to try to clear things up in the docs.

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)