V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nthin0
V2EX  ›  Podcast

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

  •  
  •   nthin0 · 2020-04-01 12:13:22 +08:00 · 524 次点击
    这是一个创建于 1457 天前的主题,其中的信息可能已经有所发展或是发生改变。

    导出 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
    

    有需要的自取

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1152 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:01 · PVG 07:01 · LAX 16:01 · JFK 19:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.