• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[Add More Video Sites] BB Code Media


Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: cbsnews

Site Title: CBS News

Site URL: http://www.cbsnews.com/video/

Match URLs: http://www.cbsnews.com/video/watch/?id={$id}

Embed HTML:

Code:
<see html callback>

Then under Advanced Options:

Embed HTML Callback: MediaSites_CBSNews::buildEmbed

And you need to create the following directory/file (also attached to this post):

library/MediaSites/CBSNews.php

Code:
<?php

class MediaSites_CBSNews
{
	public static function buildEmbed($mediaKey, array $site)
	{
		// CAPTURE WEB PAGE
		$pageHtml = file_get_contents('http://www.cbsnews.com/video/watch/?id=' . $mediaKey);

		// ISOLATE THE VIDEOID IN THE SOURCE
		if(preg_match('/[^\w]CBSVideo\.setVideoId\("(?P<videoid>[^"]+)"\);/siU', $pageHtml, $match))
		{
			// DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __VIDEOID__ AND __MEDIAKEY__
			$embedHtml = '<embed src="http://cnettv.cnet.com/av/video/cbsnews/atlantis2/cbsnews_player_embed.swf" scale="noscale" salign="lt" type="application/x-shockwave-flash" background="#333333" width="425" height="279" allowFullScreen="true" allowScriptAccess="always" FlashVars="si=254&&contentValue=__VIDEOID__&shareUrl=http://www.cbsnews.com/video/watch/?id=__MEDIAKEY__" />';

			// MAKE THE REPLACEMENTS
			$finalHtml = str_replace(array('__VIDEOID__', '__MEDIAKEY__'), array($match['videoid'], $mediaKey), $embedHtml);

			// RETURN THE FINISHED HTML
			return $finalHtml;
		}

		// RETURN NOTHING IF NO MATCH
		return '';
	}
}

URLs tested:
http://www.cbsnews.com/video/watch/?id=7388130n
http://www.cbsnews.com/video/watch/?id=7388144n
 

Attachments

Okay, I have users who are looking to add a few different video sites, namely Failblog and Dorkly. I thought I'd be able to do Dorkly but couldn't even find embed codes for Failblog.

I was wrong. I can't even get Dorkly to embed and I'm not sure quite why.

I modeled it after the Metacafe one as it uses about the same information. But I think it isn't working thanks to the source being a little different.

Thoughts?
dorkly.webp
 
You really saved my day!

PS: the tested url above here rocks :D

Xenforo does not display the advanced options tab to me?

soundclouds.png


Please Help Me,
Sinmix,
 
Can some get MLG.tv working. I just want the url of the video to be posted and then the video and be embeded. I've gotten about 10 other videos sites on there by myself but this is one I am having trouble figuring out because the id is not in the URL of the video
 
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: mlgtv

Site Title: MLG TV

Site URL: http://tv.majorleaguegaming.com/

Match URLs: http://tv.majorleaguegaming.com/videos/{$id}

Embed HTML:

Code:
Code:
<see html callback>




In Advanced Options:

Embed HTML Callback: MediaSites_MGL::buildEmbed

Create the following directory/file (also attached to this post):

library/MediaSites/MGL.php
I am using the "Jake Bunce template post media sites" to reply to you.
 

Attachments

Has anyone got the new sound cloud player to work with BB Code in 1.1.x? It's something I tried to do but couldn't get my head around it at all! Did search the thread and couldn't see anything other than that you need 1.1.x which I thought would be the case. Any help would be greatly appreciated!
 
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: flickr

Site Title: Flickr

Site URL: http://www.flickr.com/

Match URLs: http://www.flickr.com/photos/*/{$id}

Embed HTML:

Code:
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=109786" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param name="flashvars" value="intl_lang=en-us&photo_id={$id}"></param>
<param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=109786"></param>
<param name="bgcolor" value="#000000"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=109786" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&photo_id={$id}" height="300" width="400"></embed>
</object>

URLs tested:
http://www.flickr.com/photos/mactonnies/3663762503/
http://www.flickr.com/photos/mactonnies/3450774179/

Crazy question, but is there any way to mod this code to show photos? For whatever reason, using the image button doesn't work for Flickr, even when the pic is public. Example:

http://www.flickr.com/photos/95484927@N00/6414360515/
 
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: ebay

Site Title: Ebay Item

Site URL:http://www.ebay.com

Match URLs: #ebay\.com/itm/[a-z-0-9-]+\/(?P<id>[0-9]+)\?.+#siU

Embed HTML:

Code:
Code:
<object width="355" height="300">
    <param name="movie" value="http://togo.ebay.com/togo/togo.swf?2008013100" />
    <param name="flashvars" value="base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid={$id}&query=server" />
    <embed src="http://togo.ebay.com/togo/togo.swf?2008013100" type="application/x-shockwave-flash" width="355" height="300" flashvars="base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid={$id}&query=server"></embed>
</object>




In Advanced Options:

Regular Expression Matching:pcre.webp


_________________
example:
ebayItem.webp

demo: http://xenxero.com/index.php?threads/ebay-single-item.64/



Thanks Jake for explaining what I was missing up until now. Without you my regex would still be sitting in a text document with the rest of the list I have yet to complete :)
 
Top Bottom