OPML to Markdown

less than 1 minute read

When you export your podcast subscriptions from Overcast, you get an OPML file something like this:

Note that the file contains usernames and passwords in the feed URL

I wanted to convert the OPML to a Markdown list. Something like this:

* [text](htmlUrl) [RSS](xmlUrl)

Well a little fancier, I wanted a FontAwesome RSS SVG icon as the feed link:

* [text](htmlUrl) <a style="color:#fa9b39" href="xmlURL" itemprop="sameAs">
<i class="fas fa-fw fa-rss-square" aria-hidden="true"></i></a>

I customized a Python script by Dom Davis to:

  • Output an unordered list instead of headers.
  • Sort the list alphabetically.
  • In addition to the title (text)
    • extract the feed URL (xmlUrl)
    • and the podcast home page (htmlUrl)
  • Strip username:password from feed URLs.
  • Strip (Ad-Free) from titles as they made each line too long.

This generates the Markdown for you to paste into your post:

To remove the real username:password from opml2md.py before posting the gist, a little sed:

sed -i '' "s/passwd = .*/passwd = \"username:password@\"/" opml2md.py