IT story

Github : 리포지토리의 다운로드 수를 볼 수 있습니까?

hot-time 2020. 7. 13. 07:55
반응형

Github : 리포지토리의 다운로드 수를 볼 수 있습니까?


Github에서 리포지토리의 다운로드 수를 볼 수있는 방법이 있습니까?


2019 업데이트 :

Ustin답변 은 다음과 같습니다.

  • API /repos/:owner/:repo/traffic/clones, 하루 또는 주당 총 클론 수 및 분석 수를 가져 오려면 지난 14 일 동안 만 사용하십시오.
  • 아래 언급 된 /repos/:owner/:repo/releases/:release_id필드의 자산 수 (릴리스에 첨부 된 파일) 다운로드 횟수를 가져 오기위한 API download_count이지만 주석 이있는 경우 최근 30 개의 릴리스에만 해당됩니다.

2017 업데이트

여전히 GitHub API사용 하여 릴리스 의 다운로드 수얻을 수 있습니다 ( 정확히 요청 된 것은 아님 ) . 필드의 " 단일 릴리스 가져 오기
"를 참조하십시오 .download_count

더 이상 리포 클론 수를 나타내는 트래픽 화면이 없습니다.
대신 다음과 같은 타사 서비스를 사용해야합니다.

힘내 2.14.2 릴리스


2014 년 8 월 업데이트

또한 GitHub는 트래픽 그래프에서 리포에 대한 클론 수를 제안합니다.
" 복제 그래프 "

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


2013 년 10 월 업데이트

언급 한 바와 같이 아래andyberry88 내가하고 지난 7 월 상세한 , GitHub의 현재 버전을 제안한다 (참조 자사의 API를 하는) download_count필드를 .

Michele Milidoni자신의 (공개 된) 답변 에서 파이썬 스크립트 에서 해당 필드를 사용합니다 .
( 매우 작은 추출물 )

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")

원래 답변 (2010 년 12 월)

GitHub 리포지토리 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.


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/


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.


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

여기에 이미지 설명을 입력하십시오


Formerly, there was two methods of download code in Github: clone or download as zip a .git repo, or upload a file (for example, a binary) for later download.

When download a repo (clone or download as zip), Github doesn't count the number of downloads for technical limitations. Clone a repository is a read-only operation. There is no authentication required. This operation can be done via many protocols, including HTTPS, the same protocol that the web page uses to show the repo in the browser. It's very difficult to count it.

See: http://git-scm.com/book/en/Git-on-the-Server-The-Protocols

Recently, Github deprecate the download functionality. This was because they understand that Github is focused in building software, and not in distribute binaries.

See: https://github.com/blog/1302-goodbye-uploads


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


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


The Github API does not provide the needed information anymore. Take a look at the releases page, mentioned in Stan Towianski's answer. As we discussed in the comments to that answer, the Github API only reports the downloads of 1 of the three files he offers per release.

I have checked the solutions, provided in some other answers to this questions. Vonc's answer presents the essential part of Michele Milidoni's solution. I installed his gdc script with the following result

# ./gdc stant
mdcsvimporter.mxt: 37 downloads
mdcsvimporter.mxt: 80 downloads
How-to-use-mdcsvimporter-beta-16.zip: 12 downloads

As you can clearly see, gdc does not report the download count of the tar.gz and zip files.

If you want to check without installing anything, try the web page where Somsubhra has installed the solution, mentioned in his answer. Fill in 'stant' as Github username and 'mdcsvimporter2015' as Repository name and you will see things like:

Download Info:
mdcsvimporter.mxt(0.20MB) - Downloaded 37 times.
Last updated on 2015-03-26

Alas, once again only a report without the downloads of the tar.gz and zip files. I have carefully examined the information that Github's API returns, but it is not provided anywhere. The download_count that the API does return is far from complete nowadays.


I ended up writing a scraper script to find my clone count:

#!/bin/sh
#
# This script requires:
#   apt-get install html-xml-utils
#   apt-get install jq
#
USERNAME=dougluce
PASSWORD="PASSWORD GOES HERE, BE CAREFUL!"
REPO="dougluce/node-autovivify"

TOKEN=`curl https://github.com/login -s -c /tmp/cookies.txt | \
     hxnormalize | \
     hxselect 'input[name=authenticity_token]' 2>/dev/null | \
     perl -lne 'print $1 if /value=\"(\S+)\"/'`

curl -X POST https://github.com/session \
     -s -b /tmp/cookies.txt -c /tmp/cookies2.txt \
     --data-urlencode commit="Sign in" \
     --data-urlencode authenticity_token="$TOKEN" \
     --data-urlencode login="$USERNAME" \
     --data-urlencode password="$PASSWORD" > /dev/null

curl "https://github.com/$REPO/graphs/clone-activity-data" \
     -s -b /tmp/cookies2.txt \
     -H "x-requested-with: XMLHttpRequest" | jq '.summary'

This'll grab the data from the same endpoint that Github's clone graph uses and spit out the totals from it. The data also includes per-day counts, replace .summary with just . to see those pretty-printed.


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.


Based on VonC and Michele Milidoni answers I've created this bookmarklet which displays downloads statistics of github hosted released binaries.

Note: Because of issues with browsers related to Content Security Policy implementation, bookmarklets can temporarily violate some CSP directives and basically may not function properly when running on github while CSP is enabled.

Though its highly discouraged, you can disable CSP in Firefox as a temporary workaround. Open up about:config and set security.csp.enable to false.


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: 예


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)


To try to make this more clear:
for this github project: stant/mdcsvimporter2015
https://github.com/stant/mdcsvimporter2015
with releases at
https://github.com/stant/mdcsvimporter2015/releases

go to http or https: (note added "api." and "/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


파이썬에서 솔루션이 필요한 사람들을 위해 간단한 스크립트를 작성했습니다.


파이썬 스크립트 :


용법:

ghstats.py [user] [repo] [tag] [options]


지원하다:

  • 기본적으로 Python 2Python 3을 모두 지원합니다 .
  • 독립형 모듈과 Python 모듈 모두로 사용할 수 있습니다.

참고 URL : https://stackoverflow.com/questions/4338358/github-can-i-see-the-number-of-downloads-for-a-repo

반응형