Posted on October 16, 2009 at 3:46pm EDT. More.

A Spam Filter for Facebook Events

I love that Facebook exports events as a calendar that I can subscribe to in Apple iCal or Google Calendar. It saves much copying and pasting. Unfortunately, somebody is almost always creating an event that spans several days. Then my calendar looks like this:

This is annoying, because that purple monster isn’t even a real event; it’s just a notice that somebody’s film is available for download from Amazon. As much as I encourage everybody to watch that film, I don’t want it eating up my calendar. I am routinely invited to events like this, and they are always announcements, or “I’m looking for a roommate,” or “I was too lazy to create four separate events for the show I’m doing four times this month.” In other words, calendar spam.

This would be tolerable, if there were some way to hide individual events, but there isn’t. Facebook includes every event you’ve been invited to, even if you RSVP: Not Attending. You can uninvite yourself using the “Remove from My Events” link, but it's tedious and doesn’t protect you from being re-invited in the future. It’s also of no use if you’re away from the computer and viewing your calendar on your iPhone.

How to Clean Your Calendar

I solved the problem with a program that acts as a proxy between your calendar app and Facebook, removing events that are longer than 12 hours. It’s on the web, so you can use it, too.

First, find your Facebook Calendar URL by going to Facebook Events and clicking “Export Events” in the top left corner. A box will appear with an address that looks something like this:

http://www.facebook.com/ical/u.php?uid=123456&key=789abcdef
To use the filter, change the first part of the address (everything before the question mark) so that it looks like this:
http://www.benzado.com/bin/icalproxy.php?uid=123456&key=789abcdef
Then you can use the new address to subscribe to your filtered calendar in apps like Apple iCal or Google Calendar.

Note that using my filter means your events pass through my web server, and even though I’m not really interested in looking at them, I could. So if you’re super concerned about your privacy, keep that in mind.

If you’d like to see how the script works or make a copy to run on your own server, you can view the source code. If you extend it in any interesting ways, please let me know.