MixCloud RSS Converter in Node.js

Continuing my love affair with Node.js, I made a MixCloud to RSS converter last weekend. Just paste in the MixCloud account URL or name you want and it’ll give you an RSS URL in return.

MixCloud RSS Converter

The source is also on GitHub if you want it.

The bit with some reminiscing you can probably skip

While at York, I was involved with (and ran) Breakz for quite a few years. Breakz is a music society that stages drum & bass, dubstep and electronic music events, and has brought some pretty major acts to York, including Chase & Status, Benga, Skream, Brookes Brothers and Ed Rush.

One of the things I did, around 5 years ago, was move the website to WordPress. I ended up jumping in after the domain expired last week, and the site needed some more TLC generally. As I had some free time, I swapped it over to a new (cheaper and faster-so-far) host and changed the theme for one based on the one I did for Premier Tri.

I added a lot of Facebook links as everything happens there now, but I wanted to put some music back on the site too. (Once upon a time, the site hosted MP3s composed by some of the DJs and links to a few online radio stations, but this bit had long since bitten the dust.) Of course there’s been an explosion in online music over the past five years, and there are a huge number of sites out there for artists to host their tunes and network with others.

Two of the most popular, with this crowd at least, are SoundCloud and MixCloud, where most of the DJs have accounts. I needed to get the tunes from there and onto the site with as little work (on their part) as possible, which basically meant syndicating RSS feeds via a WordPress plugin.

The bit about which you care

Neither SoundCloud nor MixCloud offer RSS feeds, but fortunately Adam Schlitt’s already written a converter for SoundCloud. Unfortunately I was out of luck for MixCloud (they used to have feeds, but they don’t seem to work now). So I decided to write one.

MixCloud does have an API, so I was able to use this to get a recent uploads stream and then query their oEmbed API to get an embedded music player for each post, which I then added to an RSS feed. To make it pretty, I also made a frontend using the ubiquitous Twitter Bootstrap.

I really am standing on the shoulders of giants here as this required almost no code on my part (maybe 300 lines) thanks to the node-oembed and node-rss modules from Stephan Maka and Dylan Greene, and of course Express, Jade and Node.js.

If you use it and if you can, please set the update interval to something fairly big. The app doesn’t cache anything, and every request could query MixCloud’s API around 20 times. Actually I probably shouldn’t worry about MixCloud as they no doubt have very meaty servers, but I don’t, so please think of me too. :)

Here’s the Breakz music page, which syndicates feeds from a number of MixCloud (and SoundCloud) accounts.

MixCloud RSS Converter

The code

If you’re interested in getting your own copy, I’ve put the source up on GitHub too. As there’s not a lot to it, hopefully it will (almost) just work. After adjusting the settings you should be good to go.

Settings

Please rename /config/app-sample.json to app.json.

  • modeproduction loads minimized files and includes Analytics, while development doesn’t.
  • localPort — The local port to use.
  • url — Public URL for the site.
  • title — Name of the site. Used in the browser title bar and elsewhere.
  • author — Not really used, actually. Just appears in the meta header.
  • description — Meta description content.
  • rssDescription — Short description of the feed. %user will be swapped for the current account’s name.
  • cloudcastStreamUrl — MixCloud API URL for getting profiles.
  • cloudCastOembedUrl — MixCloud API URL for getting Cloudcasts.
  • jQueryCdnUrl — Yup. Only used in production mode.
  • gaAccount — Your Google Analytics UA number.
  • gaDomain — Your Analytics domain.

Example

{
	"mode": "development",
	"localPort": 3000,
	"url": "http://bits.meloncholy.com/mixcloud-rss/",
	"title": "MixCloud to RSS converter",
	"author": "Andrew Weeks",
	"description": "Get an RSS feed for your (or anyone else's) Mixcloud mixes and podcasts.",
	"rssDescription": "Visit %user's profile on MixCloud. Listen to their recent and most popular Cloudcasts. It's free and really easy to use. MixCloud to RSS thingy hacked together by Andrew Weeks. http://meloncholy.com",
	"cloudcastStreamUrl": "http://api.mixcloud.com/%user/cloudcasts/",
	"cloudcastOembedUrl": "http://www.mixcloud.com/oembed/?url=http%3A//www.mixcloud.com%cloudcast&format=json",
	"jQueryCdnUrl": "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",
	"gaAccount": "UA-XXXXXXXX-X",
	"gaDomain": "meloncholy.com"
}

Dependencies

In case NPM doesn’t help you out for some reason, you’ll also need

Source on GitHub

Legal fun

Copyright © 2012 Andrew Weeks http://meloncholy.com

MixCloud RSS Converter is licensed under the MIT licence.

4 thoughts on MixCloud RSS Converter in Node.js

    • I’m afraid not. My MixCloud to RSS converter uses MixCloud’s embeds, which are little Flash apps. It’s not possible to get the audio stream directly as MixCloud doesn’t supply it. This means you can’t use these RSS feeds with iTunes, and rather limits their usefulness (they’re fine for embedding on a site or on Twitter, but not so good for podcasting apps).

      You could email the guys at MixCloud about this, but (for the reasons they give in the link) it’s unlikely they’ll change their minds.

      Sorry!

Reply to K.I. Cancel reply

Your email address will not be published. Required fields are marked *