在Github中,是否有一种方法可以让我看到回购的下载数量?


当前回答

访问者数量应该可以在你的仪表板>流量(或统计数据或见解):

其他回答

我用javascript写了一个小的web应用程序,用于显示Github上任何项目可用版本中所有资产的下载数量。您可以在这里试用该应用程序:http://somsubhra.github.io/github-release-stats/

GitHub已经弃用下载支持,现在支持“发布”- https://github.com/blog/1547-release-your-software。要创建一个版本,要么使用GitHub UI,要么创建一个带注释的标签(http:// git-scm.com/book/ch2-6.html),并在GitHub中添加发布说明。然后,您可以将二进制文件或“资产”上传到每个版本。

一旦你发布了一些版本,GitHub API支持获取关于它们及其资产的信息。

curl -i \
https://api.github.com/repos/:owner/:repo/releases \
-H "Accept: application/vnd.github.manifold-preview+json"

寻找‘download_count’条目。更多信息请访问http://developer.github.com/v3/repos/releases/。这部分API仍然处于预览期,所以可能会有变化。

2013年11月更新:

GitHub的发布API现在已经过了预览期,因此不再需要'Accept'标头- http://developer.github.com/changes/2013-11-04-releases-api-is-official/

不过,继续添加'Accept'标头不会造成任何伤害。

有一个很好的Chrome扩展,完全做你想要的: GitHub发布下载

很晚了,但这是你想要的答案:

https://api.github.com/repos/ [git username] / [git project] /releases

接下来,在数据中找到您要查找的项目的id。它应该在顶部附近,在url旁边。然后,导航到

https://api.github.com/repos/ [git username] / [git project] /releases/ [id] / assets

名为download_count的字段就是答案。

编辑:在你的用户名和项目名中大写字母很重要

这里是一个使用pip install PyGithub包的python解决方案

from github import Github
g = Github("youroauth key") #create token from settings page


for repo in g.get_user().get_repos():
    if repo.name == "yourreponame":
        releases = repo.get_releases()
        for i in releases:
            if i.tag_name == "yourtagname":
                for j in i.get_assets():
                    print("{} date: {} download count: {}".format(j.name, j.updated_at, j._download_count.value))