YouTube API - 按发布日期查询

发布于 2024-11-03 05:26:35 字数 1019 浏览 0 评论 0原文

我正在编写一个网络应用程序,它使用 YouTube 代码 API 来执行特定类型的搜索。在本例中,我尝试搜索与查询匹配且在两个日期之间上传的所有视频。 本文档说我可以使用published-min和published-max参数,而这个说我可以使用更新最小值和更新最大值。

这两个参数集都会导致 YouTube 返回错误:

如何将结果集限制为指定日期范围内的命中?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍白女子 2024-11-10 05:26:35

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 somehow updated-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.

错々过的事 2024-11-10 05:26:35

youtube api v3 支持带有搜索结果的 publishedAfterpublishedBefore 参数。例如:

https://www.googleapis.com/youtube/v3/search?key={{YOUKEY}}&channelId={{CHANNELID}}&part=snippet,id&order=date&maxResults=50&publishedAfter=2014-09-21T00:00:00Z&publishedBefore=2014-09-22T02:00:00Z

youtube api v3 supports publishedAfter and publishedBefore parameters with search results. For example:

https://www.googleapis.com/youtube/v3/search?key={{YOUKEY}}&channelId={{CHANNELID}}&part=snippet,id&order=date&maxResults=50&publishedAfter=2014-09-21T00:00:00Z&publishedBefore=2014-09-22T02:00:00Z
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文