Github: Can I see the number of downloads for a repo?

后端 未结 17 1027
甜味超标
甜味超标 2020-11-28 02:35

In Github, is there a way I can see the number of downloads for a repo?

相关标签:
17条回答
  • 2020-11-28 03:14

    VISITOR count should be available under your dashboard > Traffic (or stats or insights):

    enter image description here

    0 讨论(0)
  • 2020-11-28 03:16

    Answer from 2019:

    1. For number of clones you can use https://developer.github.com/v3/repos/traffic/#clones (but be aware that it returns count only for last 14 days)
    2. For get downloads number of your assets (files attached to the release), you can use https://developer.github.com/v3/repos/releases/#get-a-single-release (exactly "download_count" property of the items of assets list in response)
    0 讨论(0)
  • 2020-11-28 03:19

    GitHub has deprecated the download support and now supports 'Releases' - https://github.com/blog/1547-release-your-software. To create a release either use the GitHub UI or create an annotated tag (http:// git-scm.com/book/ch2-6.html) and add release notes to it in GitHub. You can then upload binaries, or 'assets', to each release.

    Once you have some releases, the GitHub API supports getting information about them, and their assets.

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

    Look for the 'download_count' entry. Theres more info at http://developer.github.com/v3/repos/releases/. This part of the API is still in the preview period ATM so it may change.

    Update Nov 2013:

    GitHub's releases API is now out of the preview period so the 'Accept' header is no longer needed - http://developer.github.com/changes/2013-11-04-releases-api-is-official/

    It won't do any harm to continue to add the 'Accept' header though.

    0 讨论(0)
  • 2020-11-28 03:20

    Very late, but here is the answer you want:

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

    Next, find the id of the project you are looking for in the data. It should be near the top, next to the urls. Then, navigate to

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

    The field named download_count is your answer.

    EDIT: Capitals matter in your username and project name

    0 讨论(0)
  • 2020-11-28 03:24

    As already stated, you can get information about your Releases via the API.

    For those using WordPress, I developed this plugin: GitHub Release Downloads. It allows you to get the download count, links and more information for releases of GitHub repositories.

    To address the original question, the shortcode [grd_count user="User" repo="MyRepo"] will return the number of downloads for a repository. This number corresponds to the sum of all download count values of all releases for one GitHub repository.

    Example: Example

    0 讨论(0)
提交回复
热议问题