tl;rd: NPR feeds that will play stories in the order in which they aired and that update daily are at the bottom of this post.
NPR’s Podcast/RSS feeds for their main news programs like Morning Edition and All Things Considered have been broken for a long time. The official links on the bottom of their website rarely give you all of the stories, and never in the order in which they air on the radio.
To this point in time, I’ve had two options for listening on my Android phone to stories in the order they aired:
- Use the official NPR News app
- Pros: right order, links to stories and images
- Cons: battery hog, can’t reorder articles in player, notification disappears when you pause, no play controls in notification (though you could work around this with the excellent Power Toggles App), a few other bugs
- Use NPR By Date by sadsaddle
- Pros: right order, simple, very battery efficient, really nice developer that responds quickly to email
- Cons: keeps the audio playing when a phone call comes in (dealbreaker, sadly), no play controls in notification (and no workaround for that), and the interface takes a little getting used to
All along I thought, if the feeds just worked right, I could use any podcast player I wanted. With that in mind, I spent an afternoon this past weekend writing a little PHP to fix the feeds.
Thanks to NPR By Date‘s very nice developer sadsaddle, I found the NPR API and started playing with it. I ended up figuring out that one reason the official feeds don’t work right is because they don’t use any of the API’s three date parameters in combination with the “sort=assigned” one. Adding those parameters does actually return stories in the order in which they aired, but only if you do one day at a time. The next problem is that, for programs that have multiple stories in one day, the “pubDate” timestamps embedded in the feeds themselves are usually in a haphazard order. Since that’s the time that every podcast player I know of uses to sort chronologically, that’s really the main problem.
All of that is to say the feeds were broken, and so I felt I needed to fix them. To do so, I just import the feeds on my server, clean them up with a little PHP, and send them back out in a more useful format. Things I cleaned up include:
- Order of stories (chronologically within a given day, and reverse chronologically for the previous 6 shows)
- Updated logo URLs for each individual show (so they’re not all the generic NPR logo, which is the API default)
- Made them podcast feeds with links to the actual media (done through the API, not my code)
- Added note to description that the stories are in the right order
NPR Programs: Morning Edition (in order aired)
NPR Programs: All Things Considered (in order aired)
NPR Programs: Weekend Edition Saturday (in order aired)
NPR Programs: Weekend Edition Sunday (in order aired)
NPR Programs: Wait Wait…Don’t Tell Me! (in order aired)
NPR Programs: Ask Me Another (in order aired)
NPR Programs: Fresh Air (in order aired)
Feel free to leave a comment if there’s another program whose feed isn’t working like the above, and I’ll see if I can add it.