Jeff MacKinnon's Homepage

Parsing OPML with Python

I had a request to create a human-readable list of the OPML files that I posted earlier this week.

Rather than trying to figure out how to do it manually, I did a quick search and found listparser.

The module is on pip, so the install is as simple as python -m pip install listparser

Example

At some point I will automate this script, but for now I'm using a Juypter Notebook to get the results I'm looking for to manually paste into this page.

import listparser
blogs = listparser.parse("https://jeffmackinnon.com/docs/blogs.opml")

for feed in blogs.feeds:
    print(" - ["+feed.title+" ]("+ feed.url+")")

Then I do the same thing for the News Sites and Politics OPML lists.