Discover & Rate New Music Check out ChartVote. Promote the music you like.

Download MP3s from MySpace with PHP

Disclaimer: This code is not meant to be used in any malicious way. Its only a proof of concept and should not be used to illegal download music. I am not responsible for any damages caused by this code. Use at your own risk.

Now that I got that out of the way...have at it.

How it works
With this PHP code you can specify the friendID of any artist on MySpace and it will download all the songs from the artist's profile. URLs to MP3s on MySpace have a one-time use token in them that only allows the URL to be used once, thus allowing the MP3 to be accessed only once per request. This script grabs all the parts needed to construct this URL with the token in it and grabs the MP3 like a normal browser would or like the song player on artist profiles.

This code is only a snippet of a MySpace crawler that I wrote that can spider and categorize MP3s on MySpace. My version is much more advanced in functionality so I am only posting the "meat" of the code here. Why? Because I am in a generous mood and plus its not exactly rocket science to do this.

The Code

PHP:
  1. <?php
  2.  
  3.     $artistid = 123456789;
  4.     $xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid);
  5.  
  6.     $xmlartist = simplexml_load_string($xmldata);
  7.  
  8.     echo "Artist: ".$xmlartist->name."<br>";
  9.     echo "Track Listing:<br>";
  10.  
  11.     foreach($xmlartist->playlist->song as $song) {
  12.  
  13.         $xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid."&s=".$song['bsid']);
  14.         $xmlsong = simplexml_load_string($xmldata);
  15.  
  16.         $temp = explode("?", $xmlsong->curl);
  17.         parse_str($temp[1], $urlinfo);
  18.  
  19.         $songurl = $xmlsong->durl."?bandid=".$urlinfo['bandid']."&songid=".$urlinfo['songid']."&token=".$xmlsong->token."&p=".$urlinfo['p']."&a=0";
  20.  
  21.         echo "Downloading: ".$song['bsid']."<br>";
  22.  
  23.         $mp3data = file_get_contents($songurl);
  24.         $f = fopen("/path/to/save/".$song['bsid'].".mp3", "w+");
  25.         fwrite($f, $mp3data);
  26.         fclose($f);
  27.  
  28.     }
  29.  
  30. ?>

Download: MySpace-MP3-Downloader.zip (1kb)

Life Without Facebook and MySpace

Just recently I deleted my Facebook and MySpace account to see what life is like without them and I love it.

I now have 2 less distractions I need to deal with and I am more productive because of it. I no longer have to respond to comments and messages, I don't have the urge to browse my friend's profiles to see whats going on in their life. Its not that I don't care to know whats going on with them, its that I do it less frequently now and in a more personal manner such as a phone call.

(What? Talking? You mean I have to TALK to my friends? Like using my vocal chords? HA! What about LOL's and smiley faces?)

Get unplugged! I don't see myself going back to Facebook or MySpace anytime soon because I have no need for it right now. For me it was just a waste of time and productivity.

Life Without Facebook and MySpace

Disclaimer: I am an introvert by nature. Yay for me.

MySpace Flash Workaround Hack

Last year MySpace was attacked by a flash based worm which caused MySpace to disable links from flash including getURL by appending the following properties to your object tag:

HTML:
  1. <param name="allownetworking" value="internal" />
  2. <param name="allowScriptAccess" value="never" />
  3. <param name="enableJSURL" value="false" />
  4. <param name="enableHREF" value="false" />

Yeah now that sucks. You say: "What do I do now? My cool flash widget I've spent so much time working on doesn't work properly in MySpace! Ahhh!!"

Enter the Hack
Now this isn't pretty and I don't like having to do this at all, but it works. The solution is to add a relatively positioned div that hovers on top of your flash with a transparent gif thats linked to the page you originally wanted to link to from your flash.

Example Code

HTML:
  1. <embed src="http://www.yourflashmovie.com/file.swf" width="221" height="334" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
  2. <div style="width: 90px; position: relative; top: -38px; left: 65px;">
  3. <a href="http://www.whatyouwanttolinkto.com"><img src="http://www.domain.com/blank.gif" border="0" width="100" height="20"></a>
  4. </div>

Just set the size of the GIF to the size of the region you want to be linkable and position the div correctly over that region and voila...you have a MySpace flash workaround hack.

I've tested this in Firefox 2 and IE 7. Anyone care to test this in Safari 2?

Indiefy is on MySpace

Yes I know...a horrible day right? Wrong. I may have wrote a post about how MySpace is a Social Networking STD, but I also said "yet its huge and used by millions".

MySpace is a great way to gain exposure and if you can't beat 'em, join 'em. Use MySpace at what it does best...social networking. Not because its "the best" as far as design goes, but because a boat load of people use it.

Check it out at http://www.myspace.com/indiefy and add me as a friend!

MySpace Is A Social Networking STD

Everyone and their dog has a MySpace profile. Even I had one, but that only lasted for a few weeks then I deleted it and never looked back.

MySpace is a cesspool of everything that social interaction brings. Its UGLY and user-friendly is obviously not in the dictionary's over at MySpace, but yet its huge and used by millions. Since everyone and their dog uses it, that means everyone else and their dog will use it.

The same thing goes with popular music these days. Most of the time the music is pure crap, but because its "popular" people listen to it and of course they download the ring tone because they feel they must share their unique choice of music every time someone calls.

Oh...yeah...I use Facebook. Booyah.

RSS Feed



Recommended Sites