YouTube API - 按发布日期查询
我正在编写一个网络应用程序,它使用 YouTube 代码 API 来执行特定类型的搜索。在本例中,我尝试搜索与查询匹配且在两个日期之间上传的所有视频。 本文档说我可以使用published-min和published-max参数,而这个说我可以使用更新最小值和更新最大值。
这两个参数集都会导致 YouTube 返回错误:
- published-min 返回“此服务不支持 'published-min 参数”
- updated-min 返回“此服务不支持“updated-max”参数”
- 两者都不支持 返回正确的结果集。
如何将结果集限制为指定日期范围内的命中?
I'm writing a webapp that uses the YouTube Code API to do specific types of searches. In this case, I'm trying to search for all videos that match a query, and which were uploaded between two dates. This document says I can use published-min and published-max parameters, while this one says I can use updated-min and updated-max.
Both of these parameter sets cause YouTube to return an error:
- published-min returns "This service does not support the 'published-min parameter"
- updated-min returns "This service does not support the 'updated-max' parameter"
- With neither returns a correct result set.
How can I limit my result set to hits within a specified date range?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
YouTube 数据 API 参考指南没有列出任何表明可以进行过滤的内容时间间隔一般。
published-min
参数仅在“用户活动 Feed”中公布部分 这是不同的东西,可能不是你想要的东西。或者是吗?链接中的
updated-min
参数在通用 gdata 上下文中引用。看起来他们打算描述所有专用 API 的所有共同点,但不知何故updated-min
并不是在任何地方都可用。当涉及到你的问题时。我建议按时排序(
orderby=published
)并在客户端进行过滤。我知道这不是最佳方式,但这是我能看到 Google 为我们提供的唯一方式。The Reference Guide for YouTube's Data API doesn't list anything that would suggest the possibility to filter on time interval in general.
The
published-min
argument is only advertised in the "User activity feeds" section which is something different and probably not the thing you wanted. Or is it?The
updated-min
argument in your link is referenced in a generic gdata context. It looks like they intended to describe all the things common to all the specialized APIs, but somehowupdated-min
isn't available everywhere.When it comes to your very problem. I would suggest sorting on time (
orderby=published
) and do the filtering on the client side. I know this is not the optimal way, but the only one I can see with what Google gives us.youtube api v3 支持带有搜索结果的
publishedAfter
和publishedBefore
参数。例如:youtube api v3 supports
publishedAfter
andpublishedBefore
parameters with search results. For example: