Youtube API v3 获取评论

Youtube API v3 get comments

我正在使用Comments: list方法

请求

https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=ay4MKe1u7Ec&key=`{MY_KEY}`

我用API获取评论return这个

{
 "kind": "youtube#commentListResponse",
 "etag": "\"xmg9xJZuZD438sF4hb-VcBBREXc/pGLBhpjR05yQoJV31WoAx2PEFVw\"",
 "items": []
}

comments->list 方法仅在您需要获取关于您已经知道评论 ID 的评论的附加信息时使用...或者在您的 URL 的情况下,如果您试图获取有关回复 parentID 的评论的更多详细信息。换句话说,您不能将 videoID 放入 comments->list 方法中。

你要的是commentThreads->list端点:

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

这将为您提供所有评论及其 ID ...您可以获取这些 ID,然后 运行 通过 comments->list 端点获取更详细的信息。