github-release-stats icon indicating copy to clipboard operation
github-release-stats copied to clipboard

wrong total download count if more than 100 releases

Open abbbi opened this issue 2 years ago • 0 comments

hi,

i think the total download count shown is wrong, due to the api not responding with the full sets of releases. If a project has more than 100 releases, the api needs additional parameter for paginated results, example:

$ curl -s https://api.github.com/repos/abbbi/virtnbdbackup/releases | jq .[].name | wc -l
30
$ curl -s https://api.github.com/repos/abbbi/virtnbdbackup/releases?per_page=1000 | jq .[].name | wc -l
100

$ curl -s https://api.github.com/repos/abbbi/virtnbdbackup/releases?per_page=1000 | egrep 'download_count'  | cut '-d:' -f 2 | sed 's/,/+/' | xargs echo | xargs -I N echo N 0  | bc
2292
 $ curl -s https://api.github.com/repos/abbbi/virtnbdbackup/releases | egrep 'download_count'  | cut '-d:' -f 2 | sed 's/,/+/' | xargs echo | xargs -I N echo N 0  | bc
1744

abbbi avatar Aug 02 '23 04:08 abbbi