导出 ios 自带播客订阅列表的脚本

2020-04-01 12:13:22 +08:00
 nthin0

导出 ios 自带的播客 app 订阅列表,之前可以用 itunes,macos 更新后这个功能被取消了,从网上( https://apple.stackexchange.com/questions/374696/exporting-podcasts-from-ios-app-as-opml )找到一个脚本,运行后在桌面生成 opml 文件:

#!/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

有需要的自取

555 次点击
所在节点    Podcast
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/658256

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX