Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github API: How to get all repositories written in a given language

Tags:

I was able to get all github repositories tagged with a given language in JSON format with the v2 of the github API, but this version has been deprecated last year. I can't find any way to do this with the new v3.

Any ideas?

like image 245
emepyc Avatar asked May 07 '13 10:05

emepyc


People also ask

How do I list all repositories in GitHub?

How To List All Public Repositories Belonging to a User? So, to list all public repos from a user, send a GET request to https://api.github.com/users/<USER-NAME>/repos , replacing with the actual user from whom you want to retrieve the repositories.

How do I retrieve all GitHub repositories of an organization?

You can use the github api for this. Hitting https://api.github.com/users/USERNAME/repos will list public repositories for the user USERNAME.

How do I show languages in GitHub?

To see your language percentage being used in your repository, simply click anywhere on the color bar… and you'll see the breakdown of languages detected inside. If you want to see how GitHub is calculating these percentages, check out the github/linguist repository!

How do I change my GitHub repository language?

You cannot change the language of the repository, but you can change the attributes of the github repository. I mean that if you have a project where there are 60% css and 40% javascript you can said to github-linguist, that you want to ignore the css file. this attributes ignore the java files.


1 Answers

If I run:

> curl https://api.github.com/legacy/repos/search/Go?language=Go

{
  "repositories": [
    {
      "type": "repo",
      "username": "mattn",
      "name": "go-gtk",
      "owner": "mattn",
      "homepage": "http://mattn.github.com/go-gtk",
      "description": "Go binding for GTK",
      "language": "Go",
      "watchers": 342,
      "followers": 342,
      "forks": 67,
      "size": 416,
      "open_issues": 34,
      "score": 54.450714,
      "has_downloads": true,
      "has_issues": true,
      "has_wiki": true,
      "fork": false,
      "private": false,
      "url": "https://github.com/mattn/go-gtk",
      "created": "2009-11-26T16:58:53Z",
      "created_at": "2009-11-26T16:58:53Z",
      "pushed_at": "2013-09-02T04:29:39Z",
      "pushed": "2013-09-02T04:29:39Z"
    }
  ]
}
<TRIMMED>

Which seems to be the nature of the response you are looking for.

Also, on the latest version of the API, you can try:

curl -H 'Accept: application/vnd.github.preview.text-match+json' https://api.github.com/search/repositories?q=language:go&order=desc

Without the media type, you'll get:

{
  "message": "Not Found"
}

But with the -H media type in the request, you'll get a proper response.

On Windows:

c:\prgs\git\PortableGit-1.8.3-preview20130601\bin\curl.exe -H "Accept: application/vnd.github.preview.text-match+json" https://api.github.com/search/repositories?q=language:go&order=desc

(note the " instead of ' around the header Accept)

like image 165
Matthew McCullough Avatar answered Oct 02 '22 08:10

Matthew McCullough