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


当前回答

2019年更新:

Ustin的答案是:

API /repos/:owner/:repo/traffic/克隆,以获得每天或每周的克隆总数和崩溃,但是:仅为过去14天。 API /repos/:owner/:repo/releases/:release_id用于获取资产的下载数量(附加到发布的文件),下面提到的字段download_count,但是,正如评论所述,仅针对最近的30个版本。


更新2017

你仍然可以使用GitHub API来获得你的版本的下载计数(这不是确切的要求) 参见“Get a single release”,download_count字段。

不再有流量屏幕提到回购克隆的数量。 相反,你必须依赖第三方服务,比如:

GitItBack(网址:www.netguru.co/gititback),但这还不包括克隆的数量。 githubstats0,下面由Aveek Saha提到。 www.somsubhra.com/github-release-stats(网络档案),如下所述。 例如,这是Windows版本的最新git的编号


2014年8月更新

GitHub还在其流量图中提出了用于回购的克隆数量: 参见“克隆图形”


2013年10月更新

正如下面andyberry88所提到的,正如我去年7月所详细描述的,GitHub现在提出了发布(参见其API),它有一个download_count字段。

Michele Milidoni在他的回答中(被点赞)确实在他的python脚本中使用了这个字段。 (非常小的摘录)

c.setopt(c.URL, 'https://api.github.com/repos/' + full_name + '/releases')
for p in myobj:
    if "assets" in p:
        for asset in p['assets']:
            print (asset['name'] + ": " + str(asset['download_count']) +
                   " downloads")

原答案(2010年12月)

我不确定你能看到这些信息(如果它被记录的话),因为我在GitHub库API中没有看到它:

$ curl http://github.com/api/v2/yaml/repos/show/schacon/grit
---
repository:
  :name: grit
  :owner: schacon
  :source: mojombo/grit # The original repo at top of the pyramid
  :parent: defunkt/grit # This repo's direct parent
  :description: Grit is a Ruby library for extracting information from a
  git repository in an object oriented manner - this fork tries to
  intergrate as much pure-ruby functionality as possible
  :forks: 4
  :watchers: 67
  :private: false
  :url: http://github.com/schacon/grit
  :fork: true
  :homepage: http://grit.rubyforge.org/
  :has_wiki: true
  :has_issues: false
  :has_downloads: true

你只能看到它是否有下载。


Adam Jagosz在评论中报道:

我用它来工作 curl -H "Accept: application/vnd.github。v3 + json " https://api.github.com/repos/:用户/:回购/版本 我做错了几件事: 我需要一个实际的Github发布(不仅仅是git标签,即使Github确实显示这些下发布,额)。 发行版需要一个资产文件,而不是自动添加的压缩源代码,以便获得下载计数。

其他回答

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

如前所述,GitHub API返回二进制文件发布的下载计数。我开发了一个小脚本,通过命令行轻松获得下载计数。

2019年的答案:

对于克隆的数量,您可以使用https://developer.github.com/v3/repos/traffic/#clones(但请注意,它只返回过去14天的计数) 为了获得你的资产(附加到发行版的文件)的下载数量,你可以使用https://developer.github.com/v3/repos/releases/#get-a-single-release(确切地说,是资产列表项的“download_count”属性作为响应)

2019年更新:

Ustin的答案是:

API /repos/:owner/:repo/traffic/克隆,以获得每天或每周的克隆总数和崩溃,但是:仅为过去14天。 API /repos/:owner/:repo/releases/:release_id用于获取资产的下载数量(附加到发布的文件),下面提到的字段download_count,但是,正如评论所述,仅针对最近的30个版本。


更新2017

你仍然可以使用GitHub API来获得你的版本的下载计数(这不是确切的要求) 参见“Get a single release”,download_count字段。

不再有流量屏幕提到回购克隆的数量。 相反,你必须依赖第三方服务,比如:

GitItBack(网址:www.netguru.co/gititback),但这还不包括克隆的数量。 githubstats0,下面由Aveek Saha提到。 www.somsubhra.com/github-release-stats(网络档案),如下所述。 例如,这是Windows版本的最新git的编号


2014年8月更新

GitHub还在其流量图中提出了用于回购的克隆数量: 参见“克隆图形”


2013年10月更新

正如下面andyberry88所提到的,正如我去年7月所详细描述的,GitHub现在提出了发布(参见其API),它有一个download_count字段。

Michele Milidoni在他的回答中(被点赞)确实在他的python脚本中使用了这个字段。 (非常小的摘录)

c.setopt(c.URL, 'https://api.github.com/repos/' + full_name + '/releases')
for p in myobj:
    if "assets" in p:
        for asset in p['assets']:
            print (asset['name'] + ": " + str(asset['download_count']) +
                   " downloads")

原答案(2010年12月)

我不确定你能看到这些信息(如果它被记录的话),因为我在GitHub库API中没有看到它:

$ curl http://github.com/api/v2/yaml/repos/show/schacon/grit
---
repository:
  :name: grit
  :owner: schacon
  :source: mojombo/grit # The original repo at top of the pyramid
  :parent: defunkt/grit # This repo's direct parent
  :description: Grit is a Ruby library for extracting information from a
  git repository in an object oriented manner - this fork tries to
  intergrate as much pure-ruby functionality as possible
  :forks: 4
  :watchers: 67
  :private: false
  :url: http://github.com/schacon/grit
  :fork: true
  :homepage: http://grit.rubyforge.org/
  :has_wiki: true
  :has_issues: false
  :has_downloads: true

你只能看到它是否有下载。


Adam Jagosz在评论中报道:

我用它来工作 curl -H "Accept: application/vnd.github。v3 + json " https://api.github.com/repos/:用户/:回购/版本 我做错了几件事: 我需要一个实际的Github发布(不仅仅是git标签,即使Github确实显示这些下发布,额)。 发行版需要一个资产文件,而不是自动添加的压缩源代码,以便获得下载计数。

我创建了三个解决方案来获取GitHub版本的下载计数和其他统计数据。这些实现都能够累积GitHub API分页结果,这意味着计算总的下载数量将不是一个问题。

Web应用程序

https://qwertycube.com/github-release-stats/ 可作为PWA使用 支持GitHub API分页

node . js实现

https://github.com/kefir500/github-release-stats 可通过NPM获取 用TypeScript编写,编译成JavaScript 可以用作命令行工具吗 可以作为Node.js模块使用吗 可以在浏览器环境中使用吗 支持GitHub API分页

Python实现

https://github.com/kefir500/ghstats 可通过PyPI获得 可以用作命令行工具吗 可以作为Python模块使用吗 支持GitHub API分页