Skip to content

Instantly share code, notes, and snippets.

@sahal
Last active March 6, 2026 04:03
Show Gist options
  • Select an option

  • Save sahal/3a4994edd2aab041d78f2ecdbc94e9ab to your computer and use it in GitHub Desktop.

Select an option

Save sahal/3a4994edd2aab041d78f2ecdbc94e9ab to your computer and use it in GitHub Desktop.
Get opml subscription file from Youtube Subscription takeout

export subscriptions.csv

Visit Google's Takeout site to download your youtube subscriptions.

run convert.sh

  • Note: This depends on GNU date to output the correct date format. I don't use BSD utils, so YMMV. You might want to update the date line to a hard coded value (e.g. Mon, 02 Mar 2026 14:37:58 -0600, though I don't think it matters.)
chmod +x convert.sh
./convert.sh

output

The output should look something like this:


<?xml version="1.0" encoding="utf-8"?>
<opml version="2.0">
    <head>
        <title>Youtube Subscriptions</title>
        <dateCreated>Mon, 02 Mar 2026 14:47:09 -0600</dateCreated>
        <!-- If you're using BSD date utils you might want to use the following -->
        <!-- Mon, 02 Mar 2026 14:37:58 -0600 -->
    </head>
    <body>
        <outline title="Youtube" text="Youtube">

           <outline title="sample" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=fakechannel-id" type="rss"/>

        </outline>
    </body>
</opml>

import into opml app

I've setup gPodder to download my Youtube videos. This takes forever.

disabling subscriptions

Once its finished, you can unsubscribe from all the channels at once using the sqlite cli:

UPDATE podcast
SET pause_subscription = 1
WHERE (  pause_subscription = 0 AND section = 'Youtube' );

Verify:

SELECT title, pause_subscription FROM podcast where (  pause_subscription = 1 AND section = 'Youtube' );
#!/usr/bin/env bash
set -e
set -u
cat << EOF > opml-head.xml
<?xml version="1.0" encoding="utf-8"?>
<opml version="2.0">
<head>
<title>Youtube Subscriptions</title>
<dateCreated>$(date +"%a, %d %b %Y %T %z")</dateCreated>
<!-- If you're using BSD date utils you might want to use the following -->
<!-- Mon, 02 Mar 2026 14:37:58 -0600 -->
</head>
<body>
<outline title="Youtube" text="Youtube">
EOF
awk -F\, '{printf " <outline title=\""$3"\" xmlUrl=\"https://www.youtube.com/feeds/videos.xml?channel_id="$1 "\" type=\"rss\"\/\>\n"}' subscriptions.csv >opml-part.xml
cat << EOF > opml-foot.xml
</outline>
</body>
</opml>
EOF
# clean up errors
sed -i -e 's/.*Channel Title.*//' -e 's/.*title=\"\" .*//' -e 's/\"\"/\"/' opml-part.xml
cat opml-head.xml opml-part.xml opml-foot.xml > opml-subscriptions.xml
rm opml-{head,part,foot}.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment