Category Archives: Python

Writing my own podcatcher

Since I started moving off of Mac OS X, I’ve been looking for a replacement for iTunes for downloading my podcasts. I wanted something that would run on Linux, and either be fairly configurable or hackable.

gPodder probably came closest to providing the same basic function as iTunes for downloading, but it’s not very configurable.

Also, I don’t really want yet another program that I have to keep open all the time on my Linux desktop. I’d rather a command-line tool I can run from cron. Armangil’s podcatcher looked pretty good, except it’s in Ruby. Nothing wrong with that, I suppose, but not something I have any experience with.

Last night I came across Bashpodder. This is a podcatcher in about 20 lines of bash, only calling out to a few other command-line tools. Whoa. I had no idea it was so simple!

I briefly considered hacking on Bashpodder, but quickly decided instead to write my own in Python, because I’m much more productive in Python, and besides, it’s more fun.

So, last night, starting from scratch, I wrote a podcatcher that can download the most recent podcasts from each of my podcasts if they haven’t been downloaded before. It checks ETag and/or Last-modified to skip needless work if the feed hasn’t changed. It constructs the download filename using the feed title, episode title, and publish date.

Of course, I had a little help :-)  As usual when working in Python, people have come before me and written awesome libraries to do the heavy lifting.  In this case, feedparser and requests.

At this point it’s functional, but not anything I’d want to make public. It has no doc (not even a README), no tests, and the list of podcasts is embedded in the code. But as a proof of concept – success!