From 1b78ed44d58c23dfab081fda281313a1b0373324 Mon Sep 17 00:00:00 2001 From: per Date: Tue, 13 Nov 2018 08:55:04 +0100 Subject: [PATCH] add script for viewing github download stats --- download-stats.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 download-stats.js diff --git a/download-stats.js b/download-stats.js new file mode 100644 index 0000000..2a1edc3 --- /dev/null +++ b/download-stats.js @@ -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); +}); \ No newline at end of file