【问题标题】:Most "popular" Python repos on GitHubGitHub 上最“流行”的 Python 存储库
【发布时间】:2013-04-01 18:55:47
【问题描述】:

基于v3 documentation,我会认为:

$ curl https://api.github.com/legacy/repos/search/python?language=Python&sort=forks&order=desc

将按分叉数的降序返回前 100 个 Python 存储库。它实际上返回一个空的 (json) 存储库列表。

这个:

$ curl https://api.github.com/legacy/repos/search/python?language=Python&sort=forks

返回存储库列表(以 json 格式),但其中许多未列为 Python 存储库。

所以,显然我误解了 Github API。检索特定语言的前 N 个存储库的公认方法是什么?

【问题讨论】:

标签: json curl github github-api


【解决方案1】:

正如 pengwynn 所说——目前仅通过 GitHub 的 API 并不容易做到这一点。但是,请查看使用 GitHub 存档项目的另一种查询方式:How to find the 100 largest GitHub repositories for a past date?

本质上,您可以使用类似 SQL 的语言查询 GitHub 的历史数据。因此,如果实时结果对您来说并不重要,您可以在 https://bigquery.cloud.google.com/?pli=1 上执行以下查询,以获取截至 2013 年 4 月 1 日(昨天)的前 100 个 Python 存储库,按分叉数递减:

SELECT MAX(repository_forks) as forks, repository_url 
 FROM [githubarchive:github.timeline] 
 WHERE (created_at CONTAINS "2013-04-01" and repository_language = "Python") 
 GROUP BY repository_url 
 ORDER BY forks 
 DESC LIMIT 100

我已将查询结果以 CSV 格式放在 this Gist 中,排名靠前的几个 repos 是:

forks  repository_url
1913   https://github.com/django/django
1100   https://github.com/facebook/tornado
994    https://github.com/mitsuhiko/flask
...

【讨论】:

  • 谢谢,这非常有用!
【解决方案2】:

Repository Search API 的目的是按关键字查找 Repositories,然后通过其他可选的查询字符串参数进一步过滤这些结果。

由于您缺少?,因此您将整个预期的查询字符串作为:keyword 传递。很抱歉,我们目前不支持您通过 GitHub API 进行的预期搜索。

【讨论】:

  • 谢谢。我现在添加了一个关键字和一个?。如果不支持此查询,这是否意味着 API 文档有误或我只是误解了它?
【解决方案3】:

【讨论】:

    猜你喜欢
    • 2021-08-11
    • 2022-07-07
    • 1970-01-01
    • 2017-07-29
    • 2016-04-24
    • 2020-10-04
    • 2021-11-13
    • 2021-03-11
    • 1970-01-01
    相关资源
    最近更新 更多