我发现此链接向我展示了如何使用GitHub API获取所有存储库。
http://developer.github.com/v3/repos/#list-all-repositories
但我不知道如何找到所有PHP的存储库。
例如这只给我们一个选择快照。 https://github.com/trending?l=php
如果这是我可以找到多少个存储库的限制,我更愿意获得至少500个拥有最多观星者的PHP存储库。
之后,我想获得每个存储库的观星者和贡献者的列表。
如何使用GitHub API实现此目的?
我正在研究这些存储库的网络效应,所以我需要上面的原始数据。
答案 0 :(得分:6)
您可以使用搜索功能。以下是使用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。您可以通过将搜索API查询切换为基于time that the repositories were created的多个调用来解决此限制。
获取所有存储库后,您可以使用Starring API获取观星者列表,使用Contributors API获取贡献者列表。
此外,您可能对(非官方)GitHub Archive project感兴趣,它会跟踪,保存和公开来自公共GitHub时间轴的事件。