I am trying to get the download count of a public repo using the GitHub API and R v3.1.2. Using the public samples repo from Google I have the following:
library(jsonlite)
library(httr)
url <- "https://api.github.com/repos/googlesamples/google-services/downloads"
response <- GET(url)
json <- content(response, "text")
json <- fromJSON(json)
print(json)
However, I noticed that json returns an empty list. Is it because there are no releases in this public repo? The goal is to determine how many times this repo has been downloaded by the public -- or any other public repo for that matter. Is this even possible?
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) Show activity on this post.
That does not seem to be possible. You only have statistics, but not on downloads (unless you are talking about downloads of the releases associated with your project), or on clones of your repo.
Every account using Git Large File Storage receives 1 GB of free storage and 1 GB a month of free bandwidth. If the bandwidth and storage quotas are not enough, you can choose to purchase an additional quota for Git LFS.
You can find the link to the left of the nav bar. It is able to compute stats for a project (a group of git repositories) as well as for a contributor and a group of contributors. It provides a REST interface and a web UI.
The old Github download counts have been deprecated and don't seem to work any longer. You can get download counts from releases, but it does take a little bit of manipulation:
library(jsonlite)
library(httr)
url <- "https://api.github.com/repos/allenluce/mmap-object/releases"
response <- GET(url)
json <- content(response, "text")
json <- fromJSON(json)
print(Reduce("+", lapply(json$assets, function(x) sum(x$download_count))))
There are some caveats:
Github allows you to count the number of released files that have been downloaded, but that's about it. The google-services repo that you use as an example has neither releases nor files!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With