Because sharing is caring

Mixcloud API

Posted: November 29th, 2010 | Author: | Filed under: API, Web Development | Tags: , , | No Comments »

Recently, I came to the conclusion that the beautifull service of Mixcloud was missing a really cool feature: podcasting.

They have som really cool artists posting music on there, and I enjoy listening to mixcloud sets every day at work. But there’s just no possibility for me to take these with me in my car (as in: on my iPod).

To fix this, I developed a small service called CloudCast. It was simple, just enter the username of your favorite artist on Mixcloud and you would be redirected to a page that gave an overview of this artist’s recent mixes, and gave you an RSS/Podcast link for your favorite music player.
All was good, … for about 17 hours.

I got contacted by @matclayton on Twitter the asking me to contact him.

We had some email communication. But in the end it boiled down to this:
Mixcloud has to pay artists royalties for every time a user listens to a mix. This is also why a mix is divided into tracks, so the respective artist is paid the respective amount. Whenever you download a track to your computer, there are 2 problems:

  • they don’t know how many times you play it
  • just having the file on your computer violates copyrights

So I had to close the website (which kind of sucks, it drove a lot of traffic to my site!)
Mixcloud are soon to change the way their API works, so API-sniffing people like me can’t make cloudcast services that allow a user to download the MP3′s.
So the problem should be solved soon anyway.

However, knowledge is free. So I’m here to share what I’ve learn’t from their API.

Step 1: getting the user’s mixes

The URL you’re going to want to use is

http://api.mixcloud.com/[username]/cloudcasts/

This gives you a JSON result. For every ‘Cast’ they give you, they give you a slug. You’re going to use this slug.

Tip: You can use the parameter ‘limit’ to define how many results you want. (e.g. ?limit=50)

Step 2: getting Cast information

This one uses a different API I guess:

http://www.mixcloud.com/api/1/cloudcast/[username]/[slug].json

Also returns JSON

This gives you, somewhere in the API a variable called ‘mp3_urls’ ‘audio_formats’.
Jackpot! I hear you think. And you’d be right. However Mixcloud gives you 4 url’s. They don’t always seem to work all 4. So keep in mind you want to check those URL’s for 404′s ;-)

Step 3

Enjoy API hacking

 

 

Update: I am now thinking of developing an Android application for the same purpose. This ‘kind of’ downloads the mixes to your Android device aswell. But if the kind people of Mixcloud could provide me with an API functionality so a developer could say: “I’m now listening to Mix A from artist XYZ”. That would solve all problems… I guess