how to add hoster to Video-Directory Remixed

Itsuki Minami

New Member
actually is just import the xml that comes with the pack D: so it's pretty easy xD actually when you installed it it must have asked you to install the hosters D:, let's say you didn't installed any so do this:
1.- Go to the ACP
2.- Expand the video directory menu
3.- Click on manage hosters
4.- Click on Import Video Hoster
5.-So there are to Boxes let's click on find D: or something like that ( xD my forum is in spanish so i don't rmember xD what was the name of that button in english)
6.- Go to the includes folder of your forum and then go to the xml folder
7.- there must be files like videohoster-NameOfVideoSite click on them and you're done, if you downloaded the xml file from another place, then just search for it and do as above, and that's all xD pretty simple huh?

Ok hope it helps, and xD next time post things like this on the correct forum is a how to so it must go in....?
xD ya you guessed it right in the how to forum xD cya latter and hope it helps
 

Itsuki Minami

New Member
well actually that is a lot more complicated, first is the problem of striping the url and make a common definition for example for megavideo is:
Code:
/http:\/\/[a-z]*?[\.]?megavideo\.com\/\?v=([\w]*)/i

xD so first you got to know how to make this common defnitions (XD don't ask me when i make hosters xD I just guess 'til it works) the next step is cheking which parts of the code you need, for example you may want to remove the api part or things like that, the next problem is the thumbnail, sometimes is very hard to get the thumbnail of the video site so for example for myspace you can make a default thumb D: but well, a good way to start is open a hoster file and play with it, I know is not easy xD actually i learned all this on my own since no one seem to know xD or want to answer any of my questions, soo luck with that if you want pm me and we can work togheter with that hoster
 

mask

New Member
ummmmmmmmmmmmmmmmm
Of course, I would like to work with you on that
But unfortunately I'm not good in English
so i'll make u suffer with me a lot as well as I am not an expert in programming
I think it is better to debate the matter here and begin to analyze how the addition of a new hoster
any way we can read the code and compare the two hoster

are u will say ok :$ ?
 

mask

New Member
here u are my code

but it not work

The response of the video-server can't be read.

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

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

	function vB_VideoSharingService_google(&$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]*?[\.]?google\.[a-z]*?\/videoplay\?docid=([A-Z0-9._%-]*)/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://video.google.com/videoplay?docid=' . $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;
		}

		if (isset($arr['yt:noembed']))
		{
			$this->set_error(VSS_ERROR_NOEMBEDING);
			return false;
		}

		$this->thumbnailpath = $arr['media:group']['media:thumbnail'][0]['url'];
		$this->videodescription = $arr['media:group']['media:description']['value'];
		$this->videotitle = $arr['media:group']['media:title']['value'];
		$this->taglist = $arr['media:group']['media:keywords'];
		$this->timelength = $arr['media:group']['yt:duration']['seconds'];

		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;

		return '<embed src="http://video.google.com/googleplayer.swf?docid=' . $videoid . '&autoplay=' . $autoplay . '&fs=' . $fullscreen . '&rel=' . $related . '&ap=%2526fmt%3D18" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" id="VideoPlayback"></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 '[video=' . $videotitle . ']' . $vid . '[/video]';
		}
		else
		{
			return '[' . $this->hostername . '=' . $videotitle . ']' . $videoid . '[/' . $this->hostername . ']';
		}
	}

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

		return 'http://video.google.com/videoplay?docid=' . $videoid;
	}
}

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

mask

New Member
line 31 ....

i have change it some

here
Code:
		if (preg_match('/http:\/\/video\.google\.com\/videoplay\?docid=([\w]*)/i', $url, $matches))
 
Top