在Github中,是否有一种方法可以让我看到回购的下载数量?
当前回答
我做了一个web应用程序,以干净的格式显示GitHub发布的统计数据: https://hanadigital.github.io/grev/
其他回答
这里是一个使用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))
2019年的答案:
对于克隆的数量,您可以使用https://developer.github.com/v3/repos/traffic/#clones(但请注意,它只返回过去14天的计数) 为了获得你的资产(附加到发行版的文件)的下载数量,你可以使用https://developer.github.com/v3/repos/releases/#get-a-single-release(确切地说,是资产列表项的“download_count”属性作为响应)
为了更清楚地说明这一点: 对于这个github项目:stant/ mdcsvimportter2015 https://github.com/stant/mdcsvimporter2015 在 https://github.com/stant/mdcsvimporter2015/releases
转到HTTP或https:(注意添加了“api.”和“/repos”) https://api.github.com/repos/stant/mdcsvimporter2015/releases
你会得到这个json输出,你可以搜索"download_count":
"download_count": 2,
"created_at": "2015-02-24T18:20:06Z",
"updated_at": "2015-02-24T18:20:07Z",
"browser_download_url": "https://github.com/stant/mdcsvimporter2015/releases/download/v18/mdcsvimporter-beta-18.zip"
或者在命令行执行: Wget——no-check-certificate https://api.github.com/repos/stant/mdcsvimporter2015/releases
基于VonC和Michele Milidoni的答案,我创建了这个bookmarklet,它显示了github托管发布的二进制文件的下载统计数据。
注意:由于浏览器与内容安全策略实现相关的问题,bookmarklet可能会暂时违反一些CSP指令,并且在启用CSP时在github上运行时基本可能无法正常工作。
虽然这是非常不鼓励的,你可以禁用CSP在Firefox作为 临时的解决方案。打开about:config并设置security.csp.enable 为假。
我做了一个web应用程序,以干净的格式显示GitHub发布的统计数据: https://hanadigital.github.io/grev/
推荐文章
- 了解Git和GitHub的基础知识
- 在GitHub上有一个公共回购的私人分支?
- 只用GitHub动作在特定分支上运行作业
- Git合并与强制覆盖
- 是否有一个链接到GitHub下载文件的最新版本的存储库?
- GitHub -致命:无法读取用户名https://github.com':没有这样的文件或目录
- Github:我能看到回购的下载数量吗?
- 如何运行一个github-actions步骤,即使前一步失败,同时仍然失败的工作
- 当我试图推到原点时,为什么Git告诉我“没有这样的远程‘原点’”?
- 在GitHub repo上显示Jenkins构建的当前状态
- 如何取消在github上的拉请求?
- HEAD和master的区别
- 在另一个目录中运行操作
- GitHub克隆与OAuth访问令牌
- 我可以在GitHub上对要点进行拉请求吗?