Github:我能看到一个 repo 的下载次数吗? [英] Github: Can I see the number of downloads for a repo?
问题描述
在 Github 中,有没有一种方法可以查看存储库的下载次数?
2019 年更新:
2014 年 8 月更新
GitHub 还在其 Traffic Graph 中提出了 repo 的克隆数量:
请参阅中提到的>andyberry88,正如我去年 7 月详细介绍,GitHub 现在 提议发布(参见 它的 API),其中 有一个 download_count
字段.
Michele Milidoni,在 他的(赞成)答案,确实在 他的python脚本.
(非常小的摘录)
c.setopt(c.URL, 'https://api.github.com/repos/' + full_name + '/releases')对于 myobj 中的 p:如果资产"在 p:对于 p['assets'] 中的资产:打印(资产['名称'] + :" + str(资产['下载计数'])+"下载")
原始答案(2010 年 12 月)
我不确定你是否能看到这些信息(如果它被记录了的话),因为我在 GitHub 存储库 API:
$ curl http://github.com/api/v2/yaml/repos/show/schacon/grit---存储库::name: 砂砾:owner: schacon:source: mojombo/grit # 金字塔顶端的原始仓库:parent: defunkt/grit # 这个 repo 的直接父级:description: Grit 是一个 Ruby 库,用于从git 存储库以面向对象的方式 - 这个 fork 试图集成尽可能多的纯红宝石功能:叉子:4:观察者:67:私人:假:url: http://github.com/schacon/grit:fork: 真的:主页:http://grit.rubyforge.org/:has_wiki: 真:has_issues: 假:has_downloads: 真
您只能查看它是否有下载.
Adam Jagosz 报告 在评论中:
<块引用>我可以使用它
curl -H "Accept: application/vnd.github.v3+json";https://api.github.com/repos/:user/:repo/releases
我做错了几件事:
- 我需要一个实际的 Github 版本(不仅仅是 git 标签,尽管 Github 确实在版本下显示了那些,呃).
- 并且该版本需要一个资产文件,而不是自动添加的压缩源文件,以便获取下载计数.
In Github, is there a way I can see the number of downloads for a repo?
Update 2019:
- API
/repos/:owner/:repo/traffic/clones
, to get the total number of clones and breakdown per day or week, but: only for the last 14 days. - API
/repos/:owner/:repo/releases/:release_id
for getting downloads number of your assets (files attached to the release), fielddownload_count
mentioned below, but, as commented, only for the most recent 30 releases..
Update 2017
You still can use the GitHub API to get the download count for your releases (which is not exactly what was asked)
See "Get a single release", the download_count
field.
There is no longer a traffic screen mentioning the number of repo clones.
Instead, you have to rely on third-party services like:
GitItBack (at
www.netguru.co/gititback
), but even that does not include the number of clones.githubstats0
, mentioned below by Aveek Saha.www.somsubhra.com/github-release-stats(web archive), mentioned below.
For instance, here is the number for the latest git for Windows release
Update August 2014
GitHub also proposes the number of clones for repo in its Traffic Graph:
See "Clone Graphs"
Update October 2013
As mentioned below by andyberry88, and as I detailed last July, GitHub now proposes releases (see its API), which has a download_count
field.
Michele Milidoni, in his (upvoted) answer, does use that field in his python script.
(very small extract)
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")
Original answer (December 2010)
I am not sure you can see that information (if it is recorded at all), because I don't see it in the GitHub Repository 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
You can only see if it has downloads or not.
Adam Jagosz reports in the comments:
I got it to work with
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/:user/:repo/releases
A couple of things that I had wrong:
- I needed an actual Github release (not just git tag, even though Github does display those under releases, ugh).
- And the release needs an asset file other than the zipped source that is added automatically in order to get the download count.
这篇关于Github:我能看到一个 repo 的下载次数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!