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
-
-
$artistid = 123456789;
-
$xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid);
-
-
$xmlartist = simplexml_load_string($xmldata);
-
-
echo "Track Listing:<br>";
-
-
foreach($xmlartist->playlist->song as $song) {
-
-
$xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid."&s=".$song['bsid']);
-
$xmlsong = simplexml_load_string($xmldata);
-
-
-
$songurl = $xmlsong->durl."?bandid=".$urlinfo['bandid']."&songid=".$urlinfo['songid']."&token=".$xmlsong->token."&p=".$urlinfo['p']."&a=0";
-
-
-
-
}
-
-
?>
Download: MySpace-MP3-Downloader.zip (1kb)



My name is Noah Everett. I live in Tulsa, OK. I started 