首页 > 解决方案 > 使用github api搜索主题对应的存储库时不能指定日期范围吗?

问题描述

您将使用 github api 搜索具有注册主题的存储库。

但是,由于搜索结果限制为 1000,我想搜索日期作为限制。如下所示。

https://api.github.com/search/repositories?q=topic:AAA&createdat:2020-10-11

自从我忽略了日期并进行了搜索,还有其他方法吗?

我想请求你的帮助。谢谢你。

标签: githubgithub-api

解决方案


您的查询中有几个问题:

  • 正确的搜索查询词是created(不是 createdat)

  • 搜索查询参数由空格分隔,如下所示:

    topic:AAA created:2020-10-11
    

您的查询将是:https ://api.github.com/search/repositories?q=topic:AAA%20created:2020-10-11

文档

通过使用 >、>=、<、<= 和范围查询,您可以搜索早于或晚于另一个日期的日期,或者在某个日期范围内的日期。日期格式必须遵循 ISO8601 标准,即 YYYY-MM-DD(年-月-日)。

几个例子:

  • 在日期之后创建:

https://api.github.com/search/repositories?q=topic:AAA%20created:%3E2017-10-11

  • 在日期之间创建:

https://api.github.com/search/repositories?q=topic:AAA%20created:2017-01-01..2018-01-01


推荐阅读