跟踪Github上的发行版(二进制文件)的下载次数

mag*_*tin 16 github

所以现在你可以直接在Github上管理和发布你的二进制文件,这个功能从本月初开始(源代码).

我一直在寻找Github接口,我还没有看过下载跟踪器.这是Google Code提供的功能,我想知道Github是否具有相同功能.

请注意,我不知道回购的下载次数,这是一个不同的主题.

mag*_*tin 17

根据Petros的回答,我使用了以下两个curl命令:

获取所有版本的列表,包括其ID和下载次数:

 curl -i  https://api.github.com/repos/:owner/:repo/releases -H "Accept: application/vnd.github.manifold-preview+json"
Run Code Online (Sandbox Code Playgroud)

例如,列出OpenRefine项目的所有版本:

 curl -i  https://api.github.com/repos/openrefine/openrefine/releases -H "Accept: application/vnd.github.manifold-preview+json"
Run Code Online (Sandbox Code Playgroud)

然后获取每个版本的详细信息(您需要运行第一个查询以获取版本ID)

curl -i  https://api.github.com/repos/:owner/:repo/releases/assets/:release_id -H "Accept: application/vnd.github.manifold-preview+json"
Run Code Online (Sandbox Code Playgroud)

使用相同的示例列出包括下载编号的详细信息 google-refine-2.5-r2407.zip

curl -i  https://api.github.com/repos/openrefine/openrefine/releases/assets/6513 -H "Accept: application/vnd.github.manifold-preview+json"
Run Code Online (Sandbox Code Playgroud)

  • 第一个请求是返回一个空的json数组,尽管github显示我的repo有发布.这个答案需要更新吗? (2认同)

Pet*_*ros 9

您可以使用GitHub API来获取download_count单个版本资产的其他内容:

http://developer.github.com/v3/repos/releases/#get-a-single-release-asset

这是它目前的样子,但请查看上面的链接,以防万一有任何改变,因为这个答案是写的.

GET /repos/:owner/:repo/releases/assets/:id

{ "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1", "id": 1, "name": "example.zip", "label": "short description", "state": "uploaded", "content_type": "application/zip", "size": 1024, "download_count": 42, "created_at": "2013-02-27T19:35:32Z", "updated_at": "2013-02-27T19:35:32Z" }