Youtube API v3获得评论

Zha*_*Jie 3 google-api youtube-api

我正在使用 评论:列表方法

请求

https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=ay4MKe1u7Ec&key=`{MY_KEY}`
Run Code Online (Sandbox Code Playgroud)

我使用API​​获取注释返回此

{
 "kind": "youtube#commentListResponse",
 "etag": "\"xmg9xJZuZD438sF4hb-VcBBREXc/pGLBhpjR05yQoJV31WoAx2PEFVw\"",
 "items": []
}
Run Code Online (Sandbox Code Playgroud)

jlm*_*ald 11

comments-> list方法仅在您需要获取有关您已经知道注释ID的注释的其他信息时使用...或者如果您要获取有关回复的注释的更多详细信息,请使用您的URL.一个父ID.换句话说,您不能将videoID放入comments-> list方法中.

你想要的是commentThreads-> list endpoint:

https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&videoId=ay4MKe1u7Ec&key={YOUR_API_KEY}
Run Code Online (Sandbox Code Playgroud)

这将为您提供带有ID的所有注释...您可以获取这些ID,然后通过comments-> list端点运行它们以获得更详细的信息.