Hi i've been working on a script to take in URLS of video site's and convert them to embed's for wordpress, and it's been successful for most sites, except myspacetv which contains ? = characters.
Here's my code so far veoh works, myspace doesn't thanks.
// myspace code
define("MYSP_WIDTH", 540);
define("MYSP_HEIGHT", 438);
define("MYSP_REGEXP", "/http:\/\/vids\.myspace\.com\/index\.cfm\?fuseaction=vids\.individual&VideoID=([[:print:]]+)/");
define("MYSP_TARGET", "<object type=\"application/x-shockwave-flash\" style=\"width:".MYSP_WIDTH."px; height:".MYSP_HEIGHT."px;\" data=\"http://lads.myspace.com/videos/vplayer.swf?m=###URL###&type=video\"><param name=\"movie\" value=\"http://lads.myspace.com/videos/vplayer.swf?m=###URL###&type=video\" /></object>");
function mysp_plugin_callback($match)
{
$output = MYSP_TARGET;
$output = str_replace("###URL###", strip_tags($match[1]), $output);
return ($output);
}
function mysp_plugin($content)
{
return (preg_replace_callback(MYSP_REGEXP, 'mysp_plugin_callback', $content));
}
add_filter('the_content', 'mysp_plugin');
add_filter('comment_text', 'mysp_plugin');
// Veoh code
define("VEOH_WIDTH", 540);
define("VEOH_HEIGHT", 438);
define("VEOH_REGEXP", "/http:\/\/www\.veoh\.com\/videos\/([[:print:]]+)/");
define("VEOH_TARGET", "<object type=\"application/x-shockwave-flash\" style=\"width:".VEOH_WIDTH."px; height:".VEOH_HEIGHT."px;\" data=\"http://www.veoh.com/videodetails2.swf?permalinkId=###URL###&id=11975851&player=videodetailsembedded&videoAutoPlay=0\"><param name=\"movie\" value=\"http://www.veoh.com/videodetails2.swf?permalinkId=###URL###&id=11975851&player=videodetailsembedded&videoAutoPlay=0\" /></object>");
function veoh_plugin_callback($match)
{
$output = VEOH_TARGET;
$output = str_replace("###URL###", strip_tags($match[1]), $output);
return ($output);
}
function veoh_plugin($content)
{
return (preg_replace_callback(VEOH_REGEXP, 'veoh_plugin_callback', $content));
}
add_filter('the_content', 'veoh_plugin');
add_filter('comment_text', 'veoh_plugin');