Post comments to youtube videos using youtube api

2019-02-19 19:58发布

How can I add comments on a particular youtube video via my app? Using youtube api v3. I am able to get the comments of a youtube video using this url:

http://gdata.youtube.com/feeds/api/videos/"+VIDEO_ID+"/comments?prettyprint=true

How can I post comments?

1条回答
爷的心禁止访问
2楼-- · 2019-02-19 20:33
You can use you tube "CommentThreads: insert" to post your comment via app

https://developers.google.com/youtube/v3/docs/commentThreads/insert

following is the api call

Post url : https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&key={YOUR_API_KEY}

And body for the API call is:

Body

    { "snippet":{
      "topLevelComment":{
       "snippet":{
        "textOriginal": "YOUR_COMMENT_HERE",
        "videoId": "VIDEO_ID"
       }
      }
     }
    }

Also add don't forget to add following scope https://www.googleapis.com/auth/youtube.force-ssl

查看更多
登录 后发表回答