Github API 总计数和结果不匹配
Github API total count and results mismatch
我想知道是否有人可以帮助解决以下问题:
我正在获取一些用户数据 Github API v3,我注意到值 "total_count" 与每页记录数的总和不匹配,例如:
GET https://api.github.com/search/users?q=location%3AGermany returns 位置设置为 "Germany" 的用户,每页 30 个结果。
{
"total_count": 102814,
"incomplete_results": false,
"items": [ user1, user2, user3, ...]
Headers 声明有 34 页(参见 "last")
<https://api.github.com/search/users?q=location%3AGermany&page=2>; rel="next", <https://api.github.com/search/users?q=location%3AGermany&page=34>; rel="last"
所以每页 30 个条目,34 页总共 30 * 34 = 1'020;但这比预期的要少 100 倍。或者换句话说,只有 total_count 的 1%。我错过了什么?
正如 GitHub Developer Search API documentation 所说,
The Search API helps you search for the specific item you want to find. For example, you can find a user or a specific file in a repository. Think of it the way you think of performing a search on Google. It's designed to help you find the one result you're looking for (or maybe the few results you're looking for). Just like searching on Google, you sometimes want to see a few pages of search results so that you can find the item that best meets your needs. To satisfy that need, the GitHub Search API provides up to 1,000 results for each search.
并建议您可以使用查询来缩小搜索范围。
我想知道是否有人可以帮助解决以下问题:
我正在获取一些用户数据 Github API v3,我注意到值 "total_count" 与每页记录数的总和不匹配,例如:
GET https://api.github.com/search/users?q=location%3AGermany returns 位置设置为 "Germany" 的用户,每页 30 个结果。
{
"total_count": 102814,
"incomplete_results": false,
"items": [ user1, user2, user3, ...]
Headers 声明有 34 页(参见 "last")
<https://api.github.com/search/users?q=location%3AGermany&page=2>; rel="next", <https://api.github.com/search/users?q=location%3AGermany&page=34>; rel="last"
所以每页 30 个条目,34 页总共 30 * 34 = 1'020;但这比预期的要少 100 倍。或者换句话说,只有 total_count 的 1%。我错过了什么?
正如 GitHub Developer Search API documentation 所说,
The Search API helps you search for the specific item you want to find. For example, you can find a user or a specific file in a repository. Think of it the way you think of performing a search on Google. It's designed to help you find the one result you're looking for (or maybe the few results you're looking for). Just like searching on Google, you sometimes want to see a few pages of search results so that you can find the item that best meets your needs. To satisfy that need, the GitHub Search API provides up to 1,000 results for each search.
并建议您可以使用查询来缩小搜索范围。