简体   繁体   中英

How do I get all public GitHub repo that are PHP using GitHub API?

I found this link that shows me how to get all repositories using GitHub API.

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

But I am not sure how to find all the repositories that are PHP.

For eg this gives us only a select snapshot. https://github.com/trending?l=php

If this is a limit to how many repositories I can find out, I prefer to get at least 500 of the PHP repositories with the most stargazers.

After that, I would like to get a list of the stargazers and contributors of each repository.

How do I accomplish this using the GitHub API?

I am studying the network effects of these repositories so I need the above raw data.

You can use Search for that. Here's how you can do it using search on github.com (using the Advanced Search form ):

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

And here's the API equivalent (using the Search API ):

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

However, notice that the Search API returns only the top 1000 results and the total count . You could get around that restriction by slicing your search API query into multiple calls based on the time that the repositories were created .

After getting all repositories, you can use the Starring API to get a list of stargazers, and the Contributors API to get the list of contributors.

Also, you might be interested in the (Unofficial) GitHub Archive project which tracks, saves and exposes events from the public GitHub timeline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM