diff --git a/index.js b/index.js index 9dc367e..72e5e2f 100644 --- a/index.js +++ b/index.js @@ -106,8 +106,6 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') { // Listener on new song stream.on('metadata', function (data) { - console.info('RAW DATA:', data) - // let song = data.replace(/[^A-Za-z 0-9 .,?""!@#$%^&*()-_=+;:<>/\\|}{[\]`~]*/g, '') const song = data.substring(13, data.length - 1).replace(/\0/g, '').replace('\';', '') // Extract artist = title from song @@ -130,7 +128,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') { }, (error, response, body) => { if (!error && response.statusCode === 200) { try { - const res = JSON.parse(process.env.STREAM_PARSE ? body.replace('updateFromMediaItem(', '').replace(');', '') : body) + const res = JSON.parse(process.env.STREAM_PARSE ? body.substr(body.indexOf('{')).replace(');', '') : body) let title = null let artist = null