Monthly Archives: June 2011

How to download songs from MySpace

MySpace is a very well know place on the Internet. Even nowadays, with Facebook and other networks targeting pretty much everyone, MySpace have managed to stay around. However, that does not mean that they’ve got everything sort out… and today’s post is a workaround for its lack of downloading functionality.

Couple of days ago, a friend of mine was trying to download some music files from a MySpace account. It should be pretty straight forward, but for some reason there is no clear link to the song. Yesterday he ask me for help… and this is what I found.

Knowing your enemy

First thing first. If you’ve used MySpace before, you know that everyone has an address like<username>. The interesting thing is that every song has a unique ID very easy to find out looking to the URL of the song:<username>/music/songs/some-title-<ID>

Why do we need that ID? We need it because that’s how MySpace manage the songs. The do not know about titles and all that stuff, but ID’s.

After analysing the traffic MySpace’s player generates, I’ve found out an interesting service which reveals the location of the file:<ID>

This service returns an XML with a tag “rtmp” which contains the real address of the song. Despite the fact that they always say the song is an MP3 file, it is actually an FLV file… so bear that in mind when trying to play it! Unfortunately, you will not be able to download it right away… because they use rtmp protocol. To complicate things a little bit more, I don’t know any easy way of dealing with rtmp…

Dealing with RTMP

I’ve used an open source program called “rtmpdump”. It is a command line program, but not really complicated, so don’t worry about that. However, if you try to use it naively, you’ll find out that MySpace will not allow you to get connected. Why? Well, they only allow their own player to connect to their servers.

Despite what you might think, this is a pretty common “security” measure very easy to circumvent. So common that rtmpdump has an option built in to deal with it 😀 We only need the address of the “real” player and rtmpdump will fake its signature. How cool is that?

To save you the analysis of the web, the address of the player is

Putting everything together

So far we’ve all we need. We know how to find out the ID of a song, the location of the file for an ID and the address of the real player… how do we get the song? Let’s put everything together:

rtmpdump --swfVfy "" -r <what_ever_the_xml_has_in_it> -o <the_you_want_for_the_song>

–swfVfy is relling rtmpdump to fake the signature of whatever we write after it… in this case the official player.

-r specifies the address of the song.

-o is to tell rtmpdump where do we want to save the song. (For some reason, MySpace uses FLV format… even if the XML says the song is an MP3 file!)