Mutt
Well-known member
for the adult media embed bbcode addon I posted I was asked to add the site http://efukt.com which does not provide a embed code. I looked at ways to get it to work & could not get their flash player to embed on my end. eventually I just grabbed the URL to the .flv file and used flowplayer to display it on my end. it works perfectly fine adn the result looks like this.
first, what's your opinion on doing this? video embedding is the norm these days & if the site provides an embed code, I think nothing of it but w/ a site like this one who does not provide an embed code it seems like straight up bandwidth theft. is it improper neticate? (to try and be fair I included a link to the site under the vid)
second, I found 1 URL that did not work & I believe it's because there is a ? in the URL.
http://efukt.com/20974_u_mad?_YOU_MAD.html
I get the following error when trying to post it
can anyone suggest a way to fix this? attached are my Media BBCode settings. I assume I'm going to have to change the match url to a regular expression.
I uploaded flowplayer-3.2.7.swf & flowplayer-3.2.6.min.js from flowplayer to /xen dir/js/flowplayer/
and I uploaded the file efukt.php to /xen dir/library/MediaSites/
first, what's your opinion on doing this? video embedding is the norm these days & if the site provides an embed code, I think nothing of it but w/ a site like this one who does not provide an embed code it seems like straight up bandwidth theft. is it improper neticate? (to try and be fair I included a link to the site under the vid)
second, I found 1 URL that did not work & I believe it's because there is a ? in the URL.
http://efukt.com/20974_u_mad?_YOU_MAD.html
I get the following error when trying to post it
can anyone suggest a way to fix this? attached are my Media BBCode settings. I assume I'm going to have to change the match url to a regular expression.
I uploaded flowplayer-3.2.7.swf & flowplayer-3.2.6.min.js from flowplayer to /xen dir/js/flowplayer/
and I uploaded the file efukt.php to /xen dir/library/MediaSites/
Code:
<?php
class MediaSites_efukt
{
public static function buildEmbed($mediaKey, array $site)
{
// CAPTURE WEB PAGE
$url = 'http://efukt.com/' . $mediaKey . '.html';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'Firefox (WindowsXP) - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6');
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$pageHtml = curl_exec($ch);
// ISOLATE THE VIDEOID IN THE SOURCE
if(preg_match('/flashvars.file = \"(.+?)\"\;/s', $pageHtml, $match))
{
// DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __VIDEOID__ AND __MEDIAKEY__
$embedHtml = '<script type="text/javascript" src="./js/flowplayer/flowplayer-3.2.6.min.js"></script>
<div align="center"><a href="__VIDEOID__" style="display:block;width:520px;height:330px" id="player"></a>
<script>flowplayer("player", "./js/flowplayer/flowplayer-3.2.7.swf", { clip: { autoPlay: false, autoBuffering: true } });</script>
<font size="1"><a href="' .$url. '" target="_blank">' . $url . '</a></font></div>';
// MAKE THE REPLACEMENTS
$finalHtml = str_replace('__VIDEOID__', $match[1], $embedHtml);
// RETURN THE FINISHED HTML
return $finalHtml;
} else {
$finalHtml = 'Could Not find VideoID for <a href="' .$url. '" target="_blank">' . $url . '</a>';
return $finalHtml;
}
// RETURN NOTHING IF NO MATCH
return '';
}
}