How do I... Create a page of videos from an RSS feed such as 12seconds.tv?

You can use a DekiScript to fetch the RSS feed of a video service and then dynamically create <embed> and/or <object> tags to show the them in a page when their title contains a specific keyword.

 

First: let's create a template for our purposes; we are calling the template "VideoFeed12SecondsTV".

<div block="var title = xml.text(item['title']); var link = uri.parse(xml.text(item, 'link')); var id = link.path[#link.path - 1]" init="var feed = $0 ?? $feed ?? 'http://12seconds.tv/channel/sarahmcarr/feed'; var keyword = $1 ?? $keyword ?? 'mindtouch'; var rss = web.xml(feed)" where="string.contains(xml.text(item['title']), keyword, true)" foreach="var item in rss['channel/item']">
<h2>{{ title }}</h2>
<object width="430" height="360" type="application/x-shockwave-flash" data="http://embed.12seconds.tv/players/remotePlayer.swf">
<param name="movie" value="http://embed.12seconds.tv/players/remotePlayer.swf" />
<param name="FlashVars" value="{{ 'vid=' .. id }}" /> <embed width="430" height="360" src="http://embed.12seconds.tv/players/remotePlayer.swf" flashvars="{{ 'vid=' .. id }}"></embed></object></div>

Notice on this template we're passing in the source feed as the first parameter and the keyword to match as the second parameter.

 

Next: Use the template.

{{ template.VideoFeed12SecondsTV("http://12seconds.tv/channel/sarahmcarr/feed", "mindtouch") }}

And see the output:

MindTouch is Saving Emperor Penguins

Shake your bunny tail! MindTouch at LISA

MindTouch Bunny is on it's last leg

MindTouch at LISA Conference in San Diego

MindTouch Birthday Celebrated with GALLON of Oktoberfest

Tag page
You must login to post a comment.