PDA

Afficher la version complète : Wat.Tv sur Galerie Videos



Felin
01/05/2009, 08h21
Bonjour à toutes et à tous !

Je cherche à intergrer Wat.Tv dans le hack "Galerie Videos"

En editant le fichier .xml de Dailymotion on peut voir ceci :


<?xml version="1.0" encoding="ISO-8859-1"?>

<videohoster varname="Dailymotion" classname="Dailymotion" active="1">
<title>Dailymotion</title>
<regex />
<author>Jason Axelrod</author>
<version>1.2.4</version>
<class_file><![CDATA[<?php
/**
* Class to fetch and handle Dailymotion
*
*/
class vB_VideoSharingService_Dailymotion extends vB_VideoSharingService
{
var $hostername = 'Dailymotion';

function vB_VideoSharingService_Dailymotion(&$registry)
{
parent::vB_VideoSharingService($registry);

$this->settings =& $this->registry->videohosters[$this->hostername]['settings'];
}

function verify_service(&$url)
{
$this->url = $url;

$matches = array();

if (preg_match('/http:\/\/[a-z]*?[\.]?dailymotion\.com\/[\w\/]*video\/([\w]*)/i', $url, $matches))
{
$this->video_id = $matches[1];
return true;
}

return false;
}

function prepare_data()
{
if (!$this->verify_videoid())
{
return false;
}

//Request Video Data
$vurl = new vB_vURL($this->registry);
$vurl->set_option(VURL_URL, 'http://www.dailymotion.com/rss/video/' . $this->video_id);
$vurl->set_option(VURL_USERAGENT, 'vBulletin/' . FILE_VERSION . ' | Video Directory');
$vurl->set_option(VURL_RETURNTRANSFER, 1);
$vurl->set_option(VURL_TIMEOUT, 30);
$result = $vurl->exec();

if ($vurl->fetch_error())
{
$this->set_error(VSS_ERROR_CONNECTION);
return false;
}

require_once(DIR . '/includes/class_xml.php');

$xmlobj = new vB_XML_Parser($result);

if(!$arr = $xmlobj->parse())
{
$this->set_error(VSS_ERROR_RESPONSE);
return false;
}

$this->thumbnailpath = $arr['channel']['item']['media:thumbnail']['url'];
$this->videodescription = $arr['channel']['item']['description'];
$this->videotitle = $arr['channel']['item']['media:title'];
$this->taglist = $arr['channel']['item']['itunes:keywords'];
$this->timelength = $arr['channel']['item']['media:group']['media:content'][0]['duration'];

return true;
}

function file_save_thumbnail()
{
if (!$this->fetch_thumbnailpath() OR !$this->fetch_videoid())
{
return false;
}

require_once(DIR . '/includes/class_vurl.php');
$vurl = new vB_vURL($this->registry);
$vurl->set_option(VURL_URL, $this->fetch_thumbnailpath());
$vurl->set_option(VURL_RETURNTRANSFER, true);
$result = $vurl->exec();

$fp = fopen(DIR . '/' . $this->registry->options['videodirectory_thumbnaildir'] . '/' . $this->hostername . '/' . $this->fetch_videoid() . '.jpg', 'wb');
fwrite($fp, $result);
fclose($fp);
}

function fetch_embedcode($videoid = '', $autoplay = 1, $fullscreen = 1, $related = 0, $stats = 0)
{
$videoid = $videoid ? $videoid : $this->video_id;

if ($fullscreen == 1) { $fullscreen = 'true'; } else { $fullscreen = 'false'; }
if ($related == 1) { $related = 'yes'; } else { $related = 'no'; }

return '<embed src="http://www.dailymotion.com/swf/' . $videoid . '&autoPlay=' . $autoplay . '&related=' . $related . '" type="application/x-shockwave-flash" width="880" height="520" allowFullScreen="' . $fullscreen . '"></embed>';
}

function fetch_videobbcode($vid, $videoid = '', $videotitle = '')
{
$videoid = $videoid ? $videoid : $this->video_id;
$videotitle = $videotitle ? $videotitle : $this->video_title;

if ($this->registry->options['videodirectory_bbcode'])
{
return '
' . $vid . '';
}
else
{
return '[' . $this->hostername . '=' . $videotitle . ']' . $videoid . '[/' . $this->hostername . ']';
}
}

function fetch_videourl($videoid = '')
{
$videoid = $videoid ? $videoid : $this->video_id;

return 'http://www.dailymotion.com/video/' . $videoid . '/';
}
}

?>]]></class_file>
</videohoster>



J'ai copier collé le ficher .xml de Dailymotion, et j'ai remplacer les mots "Dailymotion" par "Wat", et les "com" par "tv"

Mais celà ne suffit pas !

Est ce que quelqu'un pourrait donner de l'eau à mon moulin et plus encore ! :)


<?xml version="1.0" encoding="ISO-8859-1"?>

<videohoster varname="Wat" classname="Wat" active="1">
<title>Wat</title>
<regex />
<author>Jason Axelrod</author>
<version>1.2.4</version>
<class_file><![CDATA[<?php
/**
* Class to fetch and handle Wat
*
*/
class vB_VideoSharingService_wat extends vB_VideoSharingService
{
var $hostername = 'Wat';

function vB_VideoSharingService_Wat(&$registry)
{
parent::vB_VideoSharingService($registry);

$this->settings =& $this->registry->videohosters[$this->hostername]['settings'];
}

function verify_service(&$url)
{
$this->url = $url;

$matches = array();

if (preg_match('/http:\/\/[a-z]*?[\.]?wat\.tv\/[\w\/]*video\/([\w]*)/i', $url, $matches))
{
$this->video_id = $matches[1];
return true;
}

return false;
}

function prepare_data()
{
if (!$this->verify_videoid())
{
return false;
}

//Request Video Data
$vurl = new vB_vURL($this->registry);
$vurl->set_option(VURL_URL, 'http://www.wat.tv/video/' . $this->video_id);
$vurl->set_option(VURL_USERAGENT, 'vBulletin/' . FILE_VERSION . ' | Video Directory');
$vurl->set_option(VURL_RETURNTRANSFER, 1);
$vurl->set_option(VURL_TIMEOUT, 30);
$result = $vurl->exec();

if ($vurl->fetch_error())
{
$this->set_error(VSS_ERROR_CONNECTION);
return false;
}

require_once(DIR . '/includes/class_xml.php');

$xmlobj = new vB_XML_Parser($result);

if(!$arr = $xmlobj->parse())
{
$this->set_error(VSS_ERROR_RESPONSE);
return false;
}

$this->thumbnailpath = $arr['channel']['item']['media:thumbnail']['url'];
$this->videodescription = $arr['channel']['item']['description'];
$this->videotitle = $arr['channel']['item']['media:title'];
$this->taglist = $arr['channel']['item']['itunes:keywords'];
$this->timelength = $arr['channel']['item']['media:group']['media:content'][0]['duration'];

return true;
}

function file_save_thumbnail()
{
if (!$this->fetch_thumbnailpath() OR !$this->fetch_videoid())
{
return false;
}

require_once(DIR . '/includes/class_vurl.php');
$vurl = new vB_vURL($this->registry);
$vurl->set_option(VURL_URL, $this->fetch_thumbnailpath());
$vurl->set_option(VURL_RETURNTRANSFER, true);
$result = $vurl->exec();

$fp = fopen(DIR . '/' . $this->registry->options['videodirectory_thumbnaildir'] . '/' . $this->hostername . '/' . $this->fetch_videoid() . '.jpg', 'wb');
fwrite($fp, $result);
fclose($fp);
}

function fetch_embedcode($videoid = '', $autoplay = 1, $fullscreen = 1, $related = 0, $stats = 0)
{
$videoid = $videoid ? $videoid : $this->video_id;

if ($fullscreen == 1) { $fullscreen = 'true'; } else { $fullscreen = 'false'; }
if ($related == 1) { $related = 'yes'; } else { $related = 'no'; }

return '<embed src="http://www.wat.tv/swf/' . $videoid . '&autoPlay=' . $autoplay . '&related=' . $related . '" type="application/x-shockwave-flash" width="880" height="520" allowFullScreen="' . $fullscreen . '"></embed>';
}

function fetch_videobbcode($vid, $videoid = '', $videotitle = '')
{
$videoid = $videoid ? $videoid : $this->video_id;
$videotitle = $videotitle ? $videotitle : $this->video_title;

if ($this->registry->options['videodirectory_bbcode'])
{
return '
' . $vid . '';
}
else
{
return '[' . $this->hostername . '=' . $videotitle . ']' . $videoid . '[/' . $this->hostername . ']';
}
}

function fetch_videourl($videoid = '')
{
$videoid = $videoid ? $videoid : $this->video_id;

return 'http://www.wat.tv/video/' . $videoid . '/';
}
}

?>]]></class_file>
</videohoster>

Ombre
01/05/2009, 08h34
Bonjour, merci de posée ta question dans le topic du hack stp, sujet fermé.