From: Timothy Date: Sat, 10 May 2025 18:47:33 +0000 (+0100) Subject: use the `https` module (#41) X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=178c7e81da59a72fb81e1435f5f18ffab7213e51;p=binbsis50.git use the `https` module (#41) iTunes now throws a 302 for the http URL redirecting to https. Upgrading to https stops the response breaking the parser. --- diff --git a/util/load_sample_tracks.js b/util/load_sample_tracks.js index 8427a5b..4c2564b 100644 --- a/util/load_sample_tracks.js +++ b/util/load_sample_tracks.js @@ -1,7 +1,7 @@ 'use strict'; const artistIds = require('./artist-ids'); -const http = require('http'); +const https = require('https'); const JSONStream = require('JSONStream'); const limit = 7; // The number of songs to retrieve for each artist const parser = JSONStream.parse(['results', true]); @@ -24,7 +24,7 @@ const options = { popIds.concat(rapIds, rockIds).join() + '&entity=song&limit=' + limit, - port: 80 + port: 443 }; /** @@ -92,7 +92,7 @@ rc.del(rooms, function(err) { throw err; } process.stdout.write('Loading sample tracks... '); - http.get(options, function(res) { + https.get(options, function(res) { res.pipe(parser); }); });