Get the current song on a radio station using NexGen
Simplest way to install nexgen is to use npm.
Just run npm install nexgen which will download nexgen and all it's dependencies.
Simply require nexgen in your code
var Nexgen = require('nexgen');
Then create an instance of Nexgen, passing the URL of the nexgen 'API'.
var nexgen = new Nexgen('http://www.theedge.co.nz/Portals/0/Inbound/NowPlaying/NowPlaying.aspx?rand=5478005029726774');
Note: If you don't know how to find this URL, open up your browser's inspector tool when listening to the radio live on their website, then look for an XHR request with the url ending with something like
NowPlaying.apsx. That is the URL for the XML 'API' that we'll use.'
nexgen.current(function(track) {
console.log('Currently playing ' + track.title + ' by ' + track.artist);
});
nexgen.next(function(track) {
console.log('Next song will be ' + track.title + ' by ' + track.artist);
});