I typically use an RSS aggregator on my commonly used machines to gather newsfeeds and my regularly read comics. One such comic is Sinfest. After searching for a way to get an rss feed for this comic, I determined that the site uses a common WebComic site script called Comikaze. This script comes standard with an RSS feed. Once I found the hidden feed, I found that it was broken, but stumbled upon another site where someone had created a wrapper to fix the error, as well as provide the feed with inline images! Cool. He wrote some nice code without having to parse the XML. I wanted to make quite a few of the same type, so I had at it.

Now, where the site I found recommended against parsing XML, I figured it might make things easier to find someone that has done the parsing work already, and use it to create my rss feeds. So I found this rssparser written in php by a guy named Gary White.

I modified it slightly for my use, removing most of the methods and adding some additional fields. The file came with a good explanation of how to use the classes included in the header of the file. It is pretty simple to use if you know a bit of php.

My Modified RSS Parser.

One of the first ones I created (since I had a solution already for sinfest) was for Penny Arcade. Now, you might say, “Penny Arcade already has an RSS Feed”. This is true, but I wanted one that ignored the “news” and displayed the comics in the feed, instead of just a link to the page. My solution is here for download, commented. This file would be saved in the same location as the rssparser.php file on your webserver or other php capable machine.

Penny Arcade Custom RSS Feed Generator

First I include the rssparser. Then, set some variables, and properties of the rssparser before using its ‘parse’ method to get all the needed data from the original feed. The php code following this uses some string variables to hold the several sections of my newly generated feed, then spits the text out to be displayed in the browser (or rss reader). The most difficult part is looping through each of the news items the number of times you specify, the rest is straight forward. I am posting code for one other comic, Ctrl+Alt+Del which was done in the same way.

Ctrl+Alt+Del Custom RSS Generator

Oh, I almost forgot, the secret to the embedded images is the < and > special html sequences… ;)

UPDATE: It seems Penny Arcade changed how the links are made in their RSS feed which breaks the posted RSS generator. There is a VERY easy way to fix it though :)

Tags: , , , , , , , , , , ,
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>