Perl, IRC, RSS, and other assorted letters

2005-08-27

As you may have noticed, somebody posted a request to create an IRC channel for digg the other day. I checked it out on freenode and found that someone had made an extremely annoying bot to read the RSS feed. It would flood the channel once every hour with a copy of the current feed. Not cool.

I decided that I wanted to write a bot that allows users to search an archived copy of the feed dating back a few weeks. I had two reasons for this: The search on digg.com is terrible and in a usability context, most people will only use such a thing on IRC when they are having a conversation about an old article and want a link without having to switch to a browser.

It was around two in the morning so I wasn't up to writing an efficient bot, just a working one. I decided that Perl would be the right tool for the job. After a few hours of hacking away at the Net::IRC library, I had something resembling a working script.

The bot is divided into two scripts, slurp and shovel. Slurp reads the RSS feed and throws any new articles in a MySQL database. Shovel is the actual IRC bot that just sits in a channel and waits for somebody to type !slurp <phrase>. Once every hour, on the hour, a cron job fires off slurp and retrieves the feeds from digg, slashdot, and wired. I wrote slurp in a fairly modular fashion, so adding another feed is just a matter of changing the command line arguments.

There is currently no system in place to remove old entries from the database. I figure that I'll just see how long it lasts before I need to start expiring stuff.

I am currently running shovelbot in the ##digg channel on freenode and in #digg on efnet. I'm not sure how long shovelbot will last on efnet because I have been k-lined for 72 hours without a reason. I don't really care because tomorrow I'm moving to RIT where I'll have a nice new class B IP for every one of my boxes.

Anyway, I'll be posting a writeup of Shovel and Slurp in the code section as soon as I get some free time. With orientation coming up this week, I'm not sure how much free time I'll have. Perhaps I'll hang out at Java Wally's for a while and work on it.

Peace.

Next post - iPod shuffle second opinion, webcam