Tuesday, December 25, 2007

Creating a Feed for TSLRP uding Yahoo Pipes

It all started with iGoogle. I wanted not to have so many tabs on screen, so I added iGoogle. I managed to find a Yahoo Mail and a Hotmail gadget. They didn't refresh on their own but Firefox's auto-reload fixed that.

I have been waiting for a while now for Team-Gizka to come out with a release of their mod for KOTOR II. This is called The Sith Lords Restoration Project or TSLRP. I got tired of watching their front page, so I decided to create a mashup of their latest version and its changelog using Yahoo Pipes

Pipes is really cool and easy to use, but filled with a host of bugs/annoyances.
  1. For some reason, the thingie insists on converting any and all output to well formed HTML - even if you dont want that. So if you remove a <div> tag, they will hide the </div> tag even from the source of the HTML output
  2. However, they fail to do this properly for invoking one pipe from another, so when you try to pass data to another pipe, the result fails.
  3. They dont allow selecting one item from a feed and passing it to a string function (or maybe I need to do more research :) ). Which means this sort of stuff requires another pipe to be created and called.
You can see the results of my labors here. The pipe is a union of the current version from this page and the mantis changelog for that version from this page.

I mentioned pipes is really easy and cool to use. They have nice samples which can be viewed by clicking the ? button on a component. They also have the idea of operators (which work on every entry in a feed) and functions (which work on a single string).

A little knowledge of regular expressions will help you a long way. Also, with the operator varint of regular expressions, there are some additional options, which are explained here (Flex!!)

By the way the operator version of regular expressions has a really strange behavior. Fighting with it probably was what kept me working on this for the longest time.

As an example: The text I got from the TSLRP home page was:

<div class="announce" align="center" style="font-size:80%;">
<a rel="nofollow" target="_blank" href="http://forums.team-gizka.org/viewtopic.php?t=670"><b>Current Build</b></a>: <b>
0.9b1</b></div>

Logically, the following should match it:


^<[^>]*>\s*\n*\s*<[^>]*><b>[^<]*</b></a>[^<]*<b>\s*\n*\s*([^<]*)</b></div>


It did match it for the String function regex, but when the operator version is applied, what does match it is:


^<[^>]*>\s*\n*\s*<[^>]*><b>[^<]*</b></a>[^<]*<b>\s*\n*\s*([^<]*)</b>

So it doesn't even recognize the </div> at the end... Go figure...

Lastly, when not viewed in a feed, the pipe output is stripped of source HTML tags, so you probably want to render it as RSS not as normal, otherwise it looks really bad.

You can see all my pipes here. Updated (01/20/2008): Or here.

No comments: