I am trying to get a list of all github repositories for a specific language (eg Java), without narrowing the search by any specific keyword. Preferably, I want to do this directly from curl, no scripting. The problem is that I've tried formatting the API URL and didn't manage to find the right one, that includes the language=Java
parameter but no keyword.
For example, the following URL seems to query for repos with the keywords "language" or "java" in their description, including some Scala and Haskell repos:
curl -X GET https://api.github.com/legacy/repos/search/language=java
On the other hand, using the ?
notation returns empty results:
curl -X GET https://api.github.com/legacy/repos/search?language=java
curl -X GET https://api.github.com/legacy/repos/search/?language=java
Lower- or upper-case J also seems irrelevant.
So how do I use the language parameter without specifying a keyword?
Comment : A trick that seems to work is to use a single-letter keyword, repeating from A to Z. Is there a less awkward way?
I would use this according to the v3 api: https://api.github.com/search/repositories?q=language:Java
In case you want to sort:
https://api.github.com/search/repositories?q=language:Java&sort=stars&order=desc
You were close to the answer. In order to get results for a specific language you have to use the colon, like this:
language:{your_language_here}
So for Java it would be:
curl -X GET https://api.github.com/legacy/repos/search/language:java
You can use the main search form on the github site to do this. But make sure you use the "language:NAME" syntax in your query and not use the dropdown list of languages.
For example: https://github.com/search?q=language%3AJava&type=Repositories
Not as easy to parse as the JSON from the API but should do the job.
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.