Skip to content

Commit

Permalink
add script for viewing github download stats
Browse files Browse the repository at this point in the history
  • Loading branch information
stuffmatic committed Nov 13, 2018
1 parent f3d97b1 commit 1b78ed4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions download-stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const https = require('https');

const options = {
hostname: 'api.github.com',
port: 443,
path: '/repos/stuffmatic/fspy-blender/releases',
method: 'GET',
headers: { 'User-Agent': 'fSpy-blender stats script' }
};

https.get(options, (resp) => {
let data = ''

resp.on('data', (chunk) => {
data += chunk;
});

resp.on('end', () => {
let releases = JSON.parse(data)
for (let i = 0; i < releases.length; i++) {
let release = releases[i]
console.log(release.tag_name)
let assets = release.assets
for (let j = 0; j < assets.length; j++) {
let asset = assets[j]
console.log(' ' + asset.name + ', ' + asset.download_count + ' downloads')
}
}

});

}).on("error", (err) => {
console.log("Error: " + err.message);
});

0 comments on commit 1b78ed4

Please sign in to comment.