[B]===========================================================[/B]
[B]HOW TO MAKE YOUR OWN SERVICE HOST XML FILES WITHOUT RSS FEEDS[/B]
[B]===========================================================[/B]

By default, I can only support video services that have their own individual media RSS files. Most video services DON'T have these files because the idea of "exportability" on the internet is still a relatively new idea. For this example I am going to use GameTrailers...

First, lets make a template file and call it "GameTrailers.xml"... take notice of the default data... If you don't have a feed to extract data from, the default data will return a valid, but empty responses (it will work, but will return no specific media information).
[CODE]<?xml version="1.0" encoding="UTF-8"?>

<service>
	<svcName></svcName>
	<svcRegex></svcRegex>
	<svcFeed></svcFeed>
	<svcValue2>null</svcValue2>
	<svcThumb><![CDATA[$vbulletin->options['bburl']."/media/media_video.jpg"]]></svcThumb>
	<svcTitle>null</svcTitle>
	<svcDesc>null</svcDesc>
	<svcLength>null</svcLength>
	<svcTags>null</svcTags>
	<svcURL></svcURL>
	<svcEmbed></svcEmbed>
</service>[/CODE]




[B][COLOR="Red"]svcName[/COLOR][/B]: The UNIQUE name of your service.
[CODE]<svcName>[COLOR="Red"]GameTrailers[/COLOR]</svcName>[/CODE]




[B][COLOR="Red"]svcRegex[/COLOR][/B]: This is the regular expression that will match your URL. Regular expressions are very simple, but confusing. Basically you need to write out an expression that will match your URL, and extract (return) a piece of data from it. So if you had the following URL: [url]http://www.gametrailers.com/video/cinematic-trailer-white-knight/22732[/url] you will need to match the URL, and extract the video id, which is 22732. I won't go into how to program regular expressions as there are tons of guides online... For this case, lets change the code to:
[CODE]<svcRegex>[COLOR="Red"]<![CDATA[http:\/\/[a-z]*?[\.]?gametrailers\.[a-z]*?\/video\/[\w_-]*\/(\d+)]]>[/COLOR]</svcRegex>[/CODE]
So this code will match the URL: [url]http://www.gametrailers.com/video/cinematic-trailer-white-knight/22732[/url] and return the value 22732




[B][COLOR="Red"]svcFeed[/COLOR][/B]: This is the URL to the file in which the system will attempt to extract information from. Ideally, this should be a single video media RSS feed; but as I said, most websites don't have this. RSS feeds are easier to extract, won't be subject to website redesigns, and transfer far less useless data. In this case, we need to find this information directly from the video's page itself. For now:
[CODE]<svcFeed>[COLOR="red"]http://www.gametrailers.com/video/media/{serviceVAL}[/COLOR]</svcFeed>[/CODE]
Notice the code {serviceVAL}. The system will replace the instance of {serviceVAL} with the extracted information 22732 from the regular expressions. So when evaluating this code, it will become: [url]http://www.gametrailers.com/video/media/22732[/url]
[PHP]	
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
<head> 
	<title>White Knight Chronicles Video Game, Cinematic Trailer HD | Game Trailers & Videos | GameTrailers.com</title> 
	
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> 
	<meta name="keywords" content="White Knight Chronicles, Cinematic Trailer HD, video game, trailers, reviews, gameplay, interviews, interviews, exclusive user movies, gt, game trailers, gametrailers.com" /> 
	<meta name="description" content="Watch the White Knight Chronicles Cinematic Trailer HD online at GameTrailers.com. Post comments online about White Knight Chronicles on the Game Trailers website." /> 
	<meta name="robots" content="index,follow" /> 
	<meta name="GoogleBot" content="index,follow" /> 
	<meta name="language" content="en" /> 
	<meta name="verify-v1" content="YNmtDQ0nFD5q9wVomDVRVZkKOnfbnVgfqobaZxJ5t70=" /> 
	<meta name="y_key" content="48f05a3114ebd78c" /> 
	
	
			<meta name="title" content="Cinematic Trailer HD - White Knight Chronicles" /> 
			<meta name="video_width" content="455" /> 
			<meta name="video_height" content="375" /> 
			<meta name="video_type" content="application/x-shockwave-flash" /> 
			<meta name="medium" content="video" /> 
		
	<link rel="stylesheet" type="text/css" href="/css/gt6_quick_reg.css" /> 
	<link rel="stylesheet" type="text/css" href="/css/gt6_fb_merge.css" /> 
	
	
			<link rel="image_src" src="http://www.gametrailers.com/moses/boxart/3241-wkcusbox.jpg" /> 


etc... excess cut because we don't care about it... [/PHP]




[B][COLOR="Red"]svcValue2[/COLOR][/B]: [B][COLOR="Red"]svcThumb[/COLOR][/B]: [B][COLOR="Red"]svcTitle[/COLOR][/B]: [B][COLOR="Red"]svcDesc[/COLOR][/B]: [B][COLOR="Red"]svcLength[/COLOR][/B]: [B][COLOR="Red"]svcTags[/COLOR][/B]: This is code that will extract information from svcFeed. Ideally, this will be supplied in an RSS tag; but since we are not using an RSS feed, but a page source instead, it can't be retrieved this way. In fact, with many websites, you won't even be able to get some of this information! Right now there is default information, and if the page above doesn't have the information to replace it, you should keep the default. Be warned that the code in these tags is EVALUATED AS CODE! So you need to make sure your code is correct, otherwise you will get errors.

The information you need to extract will be obvious from the source code of the page above
[B]serviceVAL2 [/B]- [U]null[/U]... this is only needed for services that use hidden ID codes, like Hulu
[B]Thumbnail [/B]- [I]<link rel="image_src" src="..." />[/I]...
[B]Title [/B]- [I]<meta name="title" content="..." />[/I]
[B]Description [/B]- [I]<meta name="description" content="..." />[/I]
[B]Length [/B]- [U]null[/U]... unavailable
[B]Tags[/B] - <[I]meta name="keywords" content="..." />[/I]

Since we don't have an RSS feed, we need to pull the data from the meta and link tags (which will be automatically parsed):
[CODE]<svcValue2>null</svcValue2>
<svcThumb>[COLOR="Red"]<![CDATA[$link['image_src']]]>[/COLOR]</svcThumb>
<svcTitle>[COLOR="red"]<![CDATA[$meta['title']]]>[/COLOR]</svcTitle>
<svcDesc>[COLOR="red"]<![CDATA[$meta['description']]]>[/COLOR]</svcDesc>
<svcLength>null</svcLength>
<svcTags>[COLOR="Red"]<![CDATA[$meta['keywords']]]>[/COLOR]</svcTags>[/CODE]
A thumbnail is required for each media; if it can't find a thumbnail, the media will be rejected. Not only do most websites not have per media RSS feeds, but even some of them don't even have meta tags! If they don't, you'll have to use the default values and simply ask your users to fill in their information manually.




[B][COLOR="Red"]svcURL[/COLOR][/B]: Nothing complicated here... this is just the URL back to the video...
[CODE]<svcURL>[COLOR="Red"]http://www.gametrailers.com/video/media/{serviceVAL}[/COLOR]</svcURL>[/CODE]




[B][COLOR="Red"]svcEmbed[/COLOR][/B]: This is the embed code that will be used to display the media in your library. Generally you DON'T want to use the embed code supplied by the video service, as they are never XHTML validated and are always encumbered by advertisement and useless code. However, you will still need to look at their code to learn how to make your own. Remember the replacement variables for this code {serviceVAL} will be replaced with the ID to the video. {apTF}, {ap10}, {apYN} will be replaced with true/false, 1/0, yes/no respectively based on your AUTOPLAY settings. Certain websites require different variables for their autoplay setting: autoplay=true, autoplay=1, or autoplay=yes. For this example I have constructed the following code: (GameTrailers does not have an autoplay)
[CODE]<svcEmbed>[COLOR="red"]<![CDATA[<object type="application/x-shockwave-flash" style="width: 640px; height: 392px;" data="http://www.gametrailers.com/remote_wrap.php?mid={serviceVAL}">
<param name="movie" value="http://www.gametrailers.com/remote_wrap.php?mid={serviceVAL}" />
<param name="allowfullscreen" value="true" />
</object>]]>[/COLOR]</svcEmbed>[/CODE]




When we put it all together we get this:
[CODE]<?xml version="1.0" encoding="UTF-8"?>

<service>
	<svcName>GameTrailers</svcName>
	<svcRegex><![CDATA[http:\/\/[a-z]*?[\.]?gametrailers\.[a-z]*?\/video\/[\w_-]*\/(\d+)]]></svcRegex>
	<svcFeed>http://www.gametrailers.com/video/media/{serviceVAL}</svcFeed>
	<svcValue2>null</svcValue2>
	<svcThumb><![CDATA[$meta['image_src']]]></svcThumb>
	<svcTitle><![CDATA[$meta['title']]]></svcTitle>
	<svcDesc><![CDATA[$meta['description']]]></svcDesc>
	<svcLength>null</svcLength>
	<svcTags><![CDATA[$meta['keywords']]]></svcTags>
	<svcURL>http://www.gametrailers.com/video/media/{serviceVAL}</svcURL>
	<svcEmbed><![CDATA[<object type="application/x-shockwave-flash" style="width: 640px; height: 392px;" data="http://www.gametrailers.com/remote_wrap.php?mid={serviceVAL}">
<param name="movie" value="http://www.gametrailers.com/remote_wrap.php?mid={serviceVAL}" />
<param name="allowfullscreen" value="true" />
</object>]]></svcEmbed>
</service>[/CODE]
It will extract all the required information, except LENGTH... and will put in a CRAPPY thumbnail. We don't have the real thumbnail for this since we don't have direct access to a per video media RSS feed.