Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Just a proof of concept to see if I could semi-quickly check to see what the current KEXP track was. The plan is to dig into how Alfred extensions work and see if I can make use of this. It currently can only parse the contents of [the mini playlist](
var getLiveTrack = function() {
// inefficiently get contents of first playlist element
var live = JSON.parse(document.getElementById('PlaylistItems').children[0].getAttribute('data-playlistitem').toString())
// inefficiently output results
if (live.ArtistName && live.TrackName) {
console.log(live.ArtistName + ' - ' + live.TrackName);
} else if (live.ArtistName) {
console.log(live.ArtistName + ' - unknown track');
} else if (live.TrackName) {
// i'm not sure how this would happen, but stranger things have occurred
console.log('Unknown Artist - ' + live.TrackName);
} else {
console.log('air break');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment