Youtube API - Get top comments from a video

≡放荡痞女 提交于 2020-12-31 17:31:13

问题


Is it possible to get the top comments from a video? Maybe sorted by number of thumbs up?

This is my current url:

http://gdata.youtube.com/feeds/api/videos/'+yt_id+'/comments?alt=json-in-script&callback=?&max-results=50

Thanks in advance!
Peter


回答1:


Unfortunately, i think there is no such option. You can´t (or i didn´t manage to get it working) order by rating, likes etc. of comment, because there is no gdata-tag like "rating" etc. for comments. YouTube doesn´t provide this so far. You can vote for it here




回答2:


Yes I found that sorting by relevance is a good way of doing this for example in JS:

const comments = await axios.get(`https://www.googleapis.com/youtube/v3/commentThreads?key=${YOUR_API_KEY}&textFormat=plainText&**order=relevance**&part=snippet&videoId=${YOUR_VID_ID}&maxResults=100`);


来源:https://stackoverflow.com/questions/6484884/youtube-api-get-top-comments-from-a-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!