来自带有 API 的 Youtube 视频的最大评论数? [英] Maximum number of comments from Youtube video with API?

查看:23
本文介绍了来自带有 API 的 Youtube 视频的最大评论数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用什么 Java API 代码检索所选视频的 50 多条评论?或者这是不可能的?谢谢!

解决方案

根据文档

a>,max-results 参数的最大值为 50.但是,可以使用 start-index 参数:

注意事项:

  1. 返回的提要包含一个名为 openSearch$totalResults 的属性,它为您提供(大约)总结果数.或者,您可以在获得的结果少于 50 个时退出循环.
  2. 如果需要 XML 格式的数据,可以使用 alt=rssalt=atom
  3. prettyprint=true 添加参数只是为了提高可读性

What Java API code to use to retrieve more than 50 comments for selected video? Or this is impossible? Thanks!

解决方案

According to the documentation, the maximum value for the max-results parameter is 50. However, it is possible to create a loop that reads 50 items per iteration using the start-index parameter:

Notes:

  1. The returned feed contains a property called openSearch$totalResults which gives you (approximate) number of total results. Or you can exit the loop when you get less than 50 results.
  2. You can use alt=rss or alt=atom if you want data in XML format
  3. prettyprint=true parameter is added for readability only

这篇关于来自带有 API 的 Youtube 视频的最大评论数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆