我能够使用github API v2 以 JSON 格式获取所有使用给定语言标记的 github 存储库,但该版本已于去年被弃用。我找不到任何方法来使用新的 v3做到这一点。
有任何想法吗?
我能够使用github API v2 以 JSON 格式获取所有使用给定语言标记的 github 存储库,但该版本已于去年被弃用。我找不到任何方法来使用新的 v3做到这一点。
有任何想法吗?
如果我运行:
> 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>
这似乎是您正在寻找的响应的性质。
此外,在最新版本的 API上,您可以尝试:
curl -H 'Accept: application/vnd.github.preview.text-match+json' https://api.github.com/search/repositories?q=language:go&order=desc
如果没有媒体类型,您将获得:
{
"message": "Not Found"
}
但是使用-H
请求中的媒体类型,您将得到正确的响应。
在 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
(注意"
而不是'
在标题周围Accept
)