/rss-npr-podcasts

App to deliver an RSS feed for NPR podcasts that lack them

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

rss-npr-podcasts

This folder holds the source for a small program that makes RSS feeds for the four NPR programs that don't have native RSS feeds. The programs are:

  • Morning Edition
  • All Things Considered
  • Weekend Edition Saturday
  • Weekend Edition Sunday

The program is small and stupid: it scrapes the NPR website's program pages and looks for all audio downloads.

A minor limitation is those pages don't have times for episodes; only dates. So all downloads for the same day appear to be at midnight Eastern time.

You are welcome to make your own instance of this program.

My instance is publically hosted at heroku

Credit

The original version of this app is missing-npr-podcasts (also Missing NPR Podcasts) which I used for many years. Alas, NPR retired its old API and that program stopped working, so I made this alternate version.

Build Notes

I use pipenv to capture the environment and tested using Python 3.7.

The basic web container is Flask.

To run a development copy of this server:

  • Make a .env file at the top of the tree with this content:
FLASK_ENV=development
SECRET_KEY=dev
FLASK_RUN_HOST='0.0.0.0'
FLASK_RUN_PORT=8001
  • initialize the environment with pipenv sync
  • run the server with
pipenv shell
flask run

Go to http://localhost:8001 to see the four feed URLs

Caching

The app caches results in the production environment for 10 minutes to reduce load on the NPR servers.

The current cache is in-app only (since my heroku implementation is single process). However, I used Flask-Caching to implement the caching, so its trival to change to an external cache process like memcache or redis for a multi-server cache strategy.

Testing

You can test just the scrape process by using flask scan instead of flask run.