简体   繁体   中英

Is there a way to get the number of repositories per language using Github's API?

I would like to use the Github API to retrieve the number of repositories for each language. For example,

C++ 200,134
Java 175,432
C# 123,453
...

The only API with a filter parameter would by the search repositories one:

GET /legacy/repos/search/:keyword

with the optional parameter language .

But that would returned a list of repositories on multiple page, so you would still need to make the sum yourself.

Note that very recently (as in early March, 2013), the API might limit the result to 1000 results only .

Following up on VonC's answer , the search API will now give you the total number of results matched by your query. So you can use this to get the total number of repositories for one particular language:

GET /search/repositories?q=language:languagename

Language name is case-insentitive, must be URL-encoded, and spaces must be replaced with dashes. For example (Objective C++):

GET /search/repositories?q=language:objective-c%2B%2B

{
    "total_count": 2090,
    ...

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