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

后端 未结 17 1026
甜味超标
甜味超标 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:12

    Update 2019:

    Ustin's answer points to:

    • 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), field download_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, 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"

    http://i.stack.imgur.com/uycEZ.png


    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.

提交回复
热议问题