Simple Overcast Stats

I use Overcast to listen to all my podcasts, it’s a great app by Marco Arment. Smart Speed shortens the listen time by shortening longish silences in speech like magic.

I’m a data nerd, and the app shows how many hours Smart Speed has saved (281 hours) but not the amount of podcasts I’ve got outstanding or how many I’ve listened to.

You can export the OPML feed for your account from the accounts page, including the “All Data” feed - which is handy to summarise the data I want. It’s an XML file, and I’m a python nerd so I used the untangle library to do it. I’m sure there’s better ways to do it, but this is a quick hack.

#!/usr/bin/env python3
""" parses the "All data" OPML file from 
    https://overcast.fm/account and shows some simple stats 
"""

import untangle

FILENAME = 'overcast-2.opml'
XMLDATA = untangle.parse(FILENAME)
played_episodes, episodes, podcasts = 0, 0, 0

feeds = [obj for obj in XMLDATA.opml.body.children if obj['text'] == 'feeds']

for obj in feeds:
    for playlist in obj.children:
        podcasts += 1
        for episode in playlist.children:
            if episode['played'] != "1":
                episodes += 1
            else:
                played_episodes += 1

print(f"Podcasts: {podcasts}")
print(f"Outstanding Episodes: {episodes} (played: {played_episodes})")

This is the output for my account:

Podcasts: 88
Outstanding Episodes: 154 (played: 2090)


#podcasts #python #hacks