A Weird Imagination

Download all items in a podcast

Posted in

Podcasts are a simple extension to RSS: in addition to text and a link, posts can include a file to be downloaded. In the case of podcasts, this is an audio file. Due to this, while many specialized podcast applications exist, any news aggregator will work, although it might not have the best interface for that use case.

My normal workflow for podcasts is to keep track of them in a news aggregator and explicitly download the files to a local folder. While this isn't overly onerous for a weekly podcast, it is a repetitive task that could be automated. More importantly, downloading an entire backlog of dozens of episodes that way would take a while.

And so, I present, download_podcast.py, quite likely the world's simplest podcast client. To use it, simply put download_podcast.py in your path, run chmod +x download_podcast.py to make it executable, and give it the URL of the podcast as the first argument and it will download all of the episodes into the current directory:1

$ download_podcast.py http://nightvale.libsyn.com/rss
Processing feed Welcome to Night Vale...
Processing item 1 - Pilot... Downloading... Done.
Processing item 2 - Glow Cloud... Downloading... Done.

If you run it again, it will check to see if a file exists (and has the correct size) before downloading it so it won't waste bandwidth when downloading new episodes:

$ download_podcast.py http://nightvale.libsyn.com/rss
Processing feed Welcome to Night Vale...
Processing item 1 - Pilot... File already downloaded. Skipping.
Processing item 2 - Glow Cloud... File already downloaded. Skipping.

It gets the filename from the title of the post (not the filename of the file it downloads) and sets the created time of the file to the publication date of the post.

download_podcast.py uses the feedparser library to handle parsing the feed, so it should support any feed.


  1. I do recommend running the example command and listening to Welcome to Night Vale

Comments

Have something to add? Post a comment by sending an email to comments@aweirdimagination.net. You may use Markdown for formatting.

There are no comments yet.