// Internet Duct Tape

Building an RSS Templating System

Hacking RSS with Yahoo Pipes

The blog posts might have been slow lately, but that’s only because there’s been an accumulation of interesting projects piling up on my hard drive. Here’s a few things that are in the pipe (which I’m talking about to stop my procrastination and force me to release them):

  • Sandbox Theme for Tumblr so that you can use Sandbox CSS themes on tumblr.com
  • Tumblr Theme Templates to make it easier to develop themes for tumblr.com without having to upload your theme to tumblr.com
  • Tumblr automatic backup + restore
  • WordPress.com automatic backup
  • Twitter There Will Be Followers – program to automatically follow back anyone who is following you on Twitter
  • PostMaster html2blog – automatically post formatted HTML to Tumblr, Blogger or WordPress
  • rss2html – powerful templating system for converting an RSS feed into HTML

It’s the last one I want to talk about. I’ve gotten tired of using Yahoo Pipes + Pipe Cleaner to build digest posts. It’s kind of a pain in the butt. So I want something that can take an rss feed, convert it to html so that I can use another program for automatically posting it to the blog. I’m not going the plugin route because of WordPress.com’s inability to support javascript or PHP plugins.

This is what I’ve come up with.

The idea is simple: give it an RSS feed and a template file and it will fill in parts of that template with data from RSS feed. The syntax looks like HTML with some Ruby code plugged in. I think it’ll be too hard to use for novices, but people who are comfortable with HTML and RSS should be able to use it without having to know how to program.

What can you use it for? Well, my weekly digest can be created using it. Any kind of ‘daily tweets’ type of post could be built using it. But those are just the easy stuff. It’s flexible enough that the sky is the limit. If you can do something with Yahoo Pipes, then you can do it with this program, except you’ll have fine grained control over the output.

Here’s an example.

Template

<% @rss.remove_items_tagged(['Best of Feeds', 'Monthly Digest']) %>
<ul>
  <% @rss.items.each do |item| %>
  <li>
    <%= item.title_link %><br />
    <%= item.description.no_html %><br />
  </li>
  <% end %>
  <li><%= credit_link %></li>
</ul>

HTML Output

  • Searching for the Perfect Inline Code Documentation Tool
    I have an intense love automatic documentation generation. Nothing makes me more tickled pink than seeing code and documentation living side by side in perfect harmony. I hate seeing documentation put on the company intranet only to diverge from the code it’s supposed to explain as the days go past. I hate hitting my head against a brick wall as I’m pouring through the source code trying to understand an API because at no point does it mention that it’s documented in a Word doc in another directory. This is my rule of programming: documentation should live beside the code it documents, in the comments, especially if it’s API documentation.
  • Mashing Your MP3 Music Collection with Last.FM
    One geek itch I’ve been wanting to scratch is to be able to listen to my MP3 collection using the recommendations from Last.FM. I’ve you’ve never heard of Last.FM, it is a music service that lets you listen music as a radio station over the internet. I’ve been using it for a year and a half and I love it; it’s helped me discover so much good music. I’ve found two ways to automatically build MP3 playlists using online recommendations. The first way uses iTunes replacement Media Monkey and some extensions to connect to Last.FM (thanks TJOHO!) and the second way uses software by a new startup called The Filter (backed by Peter Gabriel).
  • How to Explain RSS to Normal People – 2008 Edition
    As a geek who enjoys spending too much time on the internet, I like RSS almost as much as delicious toast. As a blogger, RSS is the shiznitz because it lets you consume a lot more information and it makes it easier for other people to read your blog without having to drop by every few days to see if you’ve written something new. For something so useful, it’s pretty hard to explain why people should use RSS. Lots of people try to do it. This is my take on it. It’s 2008 and explaining RSS should be much simpler because if you’ve used Facebook, then you’ve used RSS.
  • I Can Has Ruby?
    I have a new tumblelog for ruby stuff.
  • How to delete your Tumblr tumblelog with TumblrCleanr
    There’s one feature missing on Tumblr: how do you delete your Tumblr? At some point you might want to destroy all traces of your tumblr (privacy concerns, or you want to use it for something else) and there isn’t an option to do that — other than click the delete button on every individual post. I wanted to repurpose a tumblr I had been using for feed aggregation and it had over 18,000 posts. That’s a lot of clicks. Enter the TumblrCleanr. Provide it with your tumblr domain name as well as your username and password and it will delete up to the latest 3000 posts at a time. You can keep running it until your entire tumblr is clean as a whistle.
  • Book Review: Halting State by Charles Stross
    If you’re a programmer/gamer geek and looking for a gripping book that you won’t be able to put down then look no further than Halting State.
  • Created with rss2html

But Wait, There’s More

Like I said, that was the trivial example. Here’s a list of all the operators I have so far:

Action on All RSS Items

  • Remove Items
    • @rss.remove_items_older_than(7.days.ago): remove items older than 7 days from the list
    • @rss.remove_items_older_than(1.month.ago): remove items older than 1 month from the list
    • @rss.remove_items_tagged(‘toread’): remove any items with the tag ‘toread’
  • Ignore Tags
    • @rss.ignore_tags(‘linkblog’): don’t display the tag ‘linkblog’
    • @rss.ignore_tags(['linkblog','toread']): don’t display the tags ‘linkblog’ or ‘toread’
  • Display Tags for All Items

With Individual RSS Items

Advanced Users

Most people won’t need these, but they can be helpful for the advanced users.

  • debug(@rss): will display all of the attributes for the @rss object
  • h(string): will escape HTML code in the string.
  • rss2html(‘http://internetducttape.com/feed&#8217;, ‘idt.rhtml’): will include another feed/template combo

But Would You Use It?

I’m trying to gage how interesting this is (or even if it’s too hard to use for the normal person).  What would you like to use a program like this for? What other things would you like for it to be able to do?

Tagged with:

4 Responses

Subscribe to comments with RSS.

  1. Webomatica said, on March 17, 2008 at 9:00 am

    I’d be interested to see what you can do with the FriendFeed Feed. I’d like to display only particular items from that feed.

  2. mpb said, on March 17, 2008 at 7:19 pm

    I lean towards the simple uses. But I have found that the Pipe Cleaner doesn’t always kick in when I run the Tumblr pipe.

    The backup WordPress.com would be very useful, especially if it gives me a means similar to Zoundry of a local copy of the blog that I can search or grab titles and links to make ToC or indices or referrals in new posts.

    I don’t suppose you have anything cooking to be able to grab some of the backend WordPress.com stuff such as search terms? Their “stats” is getting better but this one aspect is still poor if trying to find out a month’s or annual search terms (all not just the most popular)

  3. Nir said, on June 16, 2008 at 9:12 am

    Cool :) I just co-wrote a small web app that provides similar functionality- it displays an RSS feed with customizable Tumblr-like themes: http://feedvolley.com/

  4. [...] Building an RSS Templating System « // Internet Duct Tape. [...]


Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 288 other followers

%d bloggers like this: