sdasdadas
sdasdadas

Reputation: 25096

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
...

Upvotes: 3

Views: 321

Answers (2)

bmaupin
bmaupin

Reputation: 15995

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,
    ...

Upvotes: 2

VonC
VonC

Reputation: 1323773

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.

Upvotes: 2

Related Questions