Question

I have finally decided to switch from the Apple Podcast app to Overcast, but I cannot find a way to move my subscriptions. A (similar question) was asked a while ago, but iTunes has changed since then, and the new MacOS app doesn't have those menus. So, I was wondering if anyone knows another way to get an OPML file.

Was it helpful?

Solution

The Podcasts app appears to store its data inside a sqlite database. Using the information inside we can create an OPML file that Overcast (or any good podcast app) will accept.

Here's a script that I made that will create the OPML file:

#!/bin/bash

sql() {
    sqlite3 "${HOME}/Library/Group Containers/"*.groups.com.apple.podcasts/Documents/MTLibrary.sqlite "select ${1} from ZMTPODCAST ${2:+"where ${2} = '${3}'"};" |\
        sed -e 's/&/\&/g' \
            -e 's/</\&lt;/g' \
            -e 's/>/\&lgt;/g' \
            -e "s/'/\&apos;/g"
}

opml_export=${HOME}/Desktop/podcasts.opml
cat > ${opml_export} << HEAD
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
  <head><title>Podcast Subscriptions</title></head>
  <body>
    <outline text="feeds">
HEAD

sql ZUUID | while read -r uuid ; do
    feed_url=$(sql ZFEEDURL ZUUID "${uuid}")
    home_url=$(sql ZWEBPAGEURL ZUUID "${uuid}")
    title=$(sql ZTITLE ZUUID "${uuid}")
    cat <<EOT
<outline type="rss" text="${title}" title="${title}" xmlUrl="${feed_url}" htmlUrl="${home_url}" />
EOT
done >> ${opml_export}

cat >> ${opml_export} << TAIL
    </outline>
  </body>
</opml>
TAIL

This will create podcasts.opml on your desktop.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top