Last active
March 11, 2025 09:50
-
-
Save jamen/9a010788f9268338c226c37fa31a093e to your computer and use it in GitHub Desktop.
Export YouTube Subscription List as RSS feeds (OPML)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Derived from https://dhariri.com/2023/youtube-sub-download | |
// See link for more information | |
// | |
// Usage | |
// 1. Go to https://www.youtube.com/feed/channels | |
// 2. Scroll to bottom | |
// 3. Run script in dev tools console | |
// 4. Save output to an .opml file | |
let channelList = ytInitialData.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].shelfRenderer.content.expandedShelfContentsRenderer.items; | |
let outlines = ''; | |
for (let channelRaw of channelList) { | |
let channel = channelRaw.channelRenderer; | |
let channelId = channel.channelId; | |
let title = channel.title.simpleText.replaceAll("\"", "\\\""); | |
outlines += `<outline type="rss" title="${title}" text="${title}" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" />\n`; | |
} | |
let opml = ` | |
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<body> | |
<outline text="YouTube Subscriptions" title="YouTube Subscriptions"> | |
${outlines} | |
</outline> | |
</body> | |
</opml> | |
` | |
console.log(opml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){window.location=document.querySelector("link[type='application/rss+xml']").href})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment