php - 如何使用 GitHub API 获取所有 PHP 公共(public) GitHub 存储库?

标签 php github github-api

我找到了这个链接,它向我展示了如何使用 GitHub API 获取所有存储库。

http://developer.github.com/v3/repos/#list-all-repositories

但我不确定如何找到所有的 PHP 存储库。

例如这只给了我们一个选择快照。 https://github.com/trending?l=php

如果这是我可以找到的存储库数量的限制,我更愿意获得至少 500 个拥有最多观星者的 PHP 存储库。

之后,我想获得每个存储库的观星者和贡献者的列表。

如何使用 GitHub API 完成此操作?

我正在研究这些存储库的网络效应,所以我需要上述原始数据。

最佳答案

您可以使用搜索功能。以下是使用 github.com 上的搜索(使用 Advanced Search form )可以做到这一点的方法:

https://github.com/search?l=PHP&o=desc&q=stars%3A%3E%3D0&s=stars&type=Repositories

这是等效的 API(使用 Search API ):

https://api.github.com/search/repositories?q=language:php&sort=stars

但是,请注意 Search API returns only the top 1000 results and the total count .您可以根据 time that the repositories were created 将搜索 API 查询分成多个调用来绕过该限制。 .

获取所有存储库后,您可以使用 Starring API获取观星者列表,以及 Contributors API获取贡献者列表。

此外,您可能对(非官方)GitHub Archive project 感兴趣它跟踪、保存和公开来自公共(public) GitHub 时间线的事件。

关于php - 如何使用 GitHub API 获取所有 PHP 公共(public) GitHub 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20218808/

相关文章:

php - 从mysql数据库中的两个不同行中减去值

PHP mysql jquery 分页修改

github - JIRA 中的自动 Github 轮询

python - 在 CircleCi 构建中引用外部私有(private) Git 存储库

git - 在 Github Action 的工作流程完成后,如何运行 GitHub Webhook?

php - 用php远程连接mysql数据库?

php - 关于为什么在 PHP 游戏中无法获得积分的建议

git - 如何将我的代码推送到 github fork

json - 使用curl通过Github API v3创建新的gist

javascript - 如何从 GitHub 检索热门用户?