2 minutes
Getting the Download Count of Github Release Assets
In git, it is customary to tag software releases with git tag
.
Git repository hosting platforms such as GitHub and GitLab have a “Releases” section.
Not every git tag must be a “release”, but a release must be assigned a git tag.
Project maintainers can then add additional information to the release, such as a changelog and release assets.
This gives maintainers a platform to attach more information to a git tag, which in itself is just a pointer to a certain git commit.
Often, maintainers upload precompiled assets for each release. Depending on the project, this can be *.msi, *.deb, *.rpm, or *.apk files. Sometimes maintainers also upload *.sha256 or even *.gpg files to accompany these assets. In addition, GitHub automatically adds both a *.zip and a *.tar.gz archive of the source code at the corresponding git tag to each releases’ assets.
Today, I am interested in getting the download count of these release assets. GitHub does not show this in the UI, but they do expose it in their API:
curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/releases/tags/TAG
This way, we can e.g. learn that at the time of writing, ~4100 people have downloaded the *.apk for Signal’s Android app v7.40.0.
Of course, not all of these downloads will be real people (and the data is easy to maliciously increase, if that’s what you want to do). But mostly, the order of magnitude is correct.
If you have too much time, you can pipe this data into jq
for further processing,
build a pretty web page with graphs around it, and whatever else you may do with this data.
For my curiousity – which is getting a quick insight into the scale of things – a | grep download_count
also does the job.
And if you don’t have curl
handy (don’t you have a
Linux VM on your phone?),
you can get the same data via a shields.io badge, directly from your browser:
https://img.shields.io/github/downloads/signalapp/signal-android/v7.40.0/total
330 Words
2025-04-11 18:00 +0000