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

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

    Here is a python solution using the pip install PyGithub package

    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))
    
    0 讨论(0)
  • 2020-11-28 03:10

    As mentioned, GitHub API returns downloads count of binary file releases. I developed a little script to easly get downloads count by command line.

    0 讨论(0)
  • 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.

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

    I have written a small web application in javascript for showing count of the number of downloads of all the assets in the available releases of any project on Github. You can try out the application over here: http://somsubhra.github.io/github-release-stats/

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

    To check the number of times a release file/package was downloaded you can go to https://githubstats0.firebaseapp.com

    It gives you a total download count and a break up of of total downloads per release tag.

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

    I had made a web app that shows GitHub release statistics in a clean format: https://hanadigital.github.io/grev/

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