使用api列出github上的所有Java存储库 [英] List all Java repositories on github using api
问题描述
我想获得一个特定语言(例如Java)的所有github存储库的列表,而不会缩小任何特定关键字的搜索范围。优选地,我想直接从curl,没有脚本。问题是,我已经尝试格式化API URL,并没有设法找到正确的,包括 language = Java
参数,但没有关键字。
I am trying to get a list of all github repositories for a specific language (e.g. 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.
例如,以下URL似乎在其描述中查询关键字为language或java的repos,包括一些Scala和Haskell repos:
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
那么如何在不指定关键字的情况下使用language参数呢?
So how do I use the language parameter without specifying a keyword?
注释:似乎工作的一个技巧是使用单个字母的关键字,从A到Z重复。是否有不太尴尬的方式?
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?
推荐答案
我会根据v3 api使用这个:
https://api.github.com/search/repositories?q=language:Java
I would use this according to the v3 api: https://api.github.com/search/repositories?q=language:Java
如果您要排序:
https://api.github.com/search/repositories?q=language:Java&sort=stars&order=desc
这篇关于使用api列出github上的所有Java存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!