]> git.example.dev Git - binbsis50.git/commitdiff
use the `https` module (#41)
authorTimothy <altrozero@gmail.com>
Sat, 10 May 2025 18:47:33 +0000 (19:47 +0100)
committerGitHub <noreply@github.com>
Sat, 10 May 2025 18:47:33 +0000 (20:47 +0200)
iTunes now throws a 302 for the http URL redirecting to https. Upgrading
to https stops the response breaking the parser.

util/load_sample_tracks.js

index 8427a5b8b264e7e5fc6d3660566ca8e699b54f38..4c2564bd92b21a95c11a79b9edd3ca85f9c013d6 100644 (file)
@@ -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);
   });
 });