Conner85 |
04-20-2008 01:27 PM |
MySpace Mini in Profile (I know, I know.. I request a lot of MySpace stuff)
I'm looking for someone to create a plugin for the MySpace Mini player to where users can just type in their user name or friend ID and the script "scrapes" their profile for the information, such as the MySpace Mini player. In the Mods forum, there's already a MySpace mp3player plugin that pulls from musician profiles, and I already have that installed, but I tried changing the <object id="mp3player" to <object id="mini" but it didn't work. So that tells me that mp3player and mini use two different types of code. mp3player uses the regular <object and <param tags while the mini is using Javascript. Here is the flash code for the MySpace mini:
Code:
<div id="mini"><embed type="application/x-shockwave-flash" src="http://lads.myspace.com/mini/mini.swf?b=NzY5MjcyMzg=&o=NDI0NjI1MA==&d=MTIwODY5NjEzOA==&i=NTQ0MTE2Njg=&a=VHJ1ZQ==&u=NTQ0MTE2Njg=" id="mini" name="mini" bgcolor="#ffffff" quality="high" allowscriptaccess="always" wmode="transparent" flashvars="e=http%3A//profile.myspace.com/index.cfm%3Ffuseaction%3Duser.viewprofile%26friendid%3D54411668&rollover1=Add song to your profile...&rollover2=Remove song from your profile...&rollover3=View user's song history...&rollover4=View artist's profile...&culture=en-US&skin=defaultskin.swf" height="51" width="295"></div>
The b=NzY .. ect is some kind of encryption for the band's user name and I'm pretty sure the o=NDI0N .. etc is some kind of encryption for the band's song. I'm not sure what the rest is for except for the id, name, bgcolor, friend ID and stuff like that.
Here is the Javascript for it:
Code:
<div id="mini">
Hello, you either have JavaScript turned off or an old version of Macromedia's Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Click here</a> to get the latest flash player.
</div>
<script type="text/javascript" language="javascript">
// <![CDATA[
var s = "http://lads.myspace.com/mini/mini.swf?b=NzY5MjcyMzg=&o=NDI0NjI1MA==&d=MTIwODY5NjEzOA==&i=NTQ0MTE2Njg=&a=VHJ1ZQ==&u=NTQ0MTE2Njg=";
var so = new SWFObject( s , "mini", "295", "51", "8", "#ffffff");
so.addParam("allowscriptaccess", "always");
so.addVariable("rollover1", "Add song to your profile...");
so.addVariable("rollover2", "Remove song from your profile...");
so.addVariable("rollover3", "View user's song history...");
so.addVariable("rollover4", "View artist's profile...");
so.addVariable("culture", "en-US");
so.addParam("wmode", "transparent");
so.addVariable("skin", "defaultskin.swf");
so.write("mini");
// ]]>
</script>
And here is the plugin code for the artist mp3player:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugins>
<plugin active="1" executionorder="5" product="vbulletin">
<title>MySpace Player</title>
<hookname>member_customfields</hookname>
<phpcode><![CDATA[
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=".$bbcode_parser->parse($userinfo["field71"],0, true);
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_PORT, 80); //Set the port number
curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
$document = curl_exec($ch);
$myplayercode = "";
if (stripos(html_entity_decode($document),"<object id=\"mp3player\""))
{
$start=stripos(html_entity_decode($document),"<object id=\"mp3player\"");
$end=stripos(html_entity_decode($document),"</object>");
$myplayercode = substr(html_entity_decode($document),$start,$end-$start);
}
]]></phpcode>
</plugin>
</plugins>
If someone could figure out how to get this plugin to pull the mini from a user's MySpace page after they type their MySpace user name into a profile field, that would be awesome.
|