Skip to content

Instantly share code, notes, and snippets.

Last active January 27, 2021 12:34
What would you like to do?
// Apologies for the hacky nature of the below - it was just bothering me so I threw this together for myself.
// I used this in firefox, just go to the manage subscriptions page in youtube and run it in the developer console. It should work in chrome as well, I forget if there is a different browser function to copy to the clipboard.
// After running it, just paste it into a file and save it with a '.ompl' extension.
function youTubeToOPML() {
output = '<?xml version="1.0" encoding="UTF-8"?>\n<opml version="1.0">\n<head>\n<title>Feed Subscriptions</title>\n</head>\n<body>\n<outline title="Youtube Subscriptions" text="Youtube Subscriptions">';
arrOfATags = [...document.querySelectorAll('a#main-link')];
rss = arrOfATags.forEach(item => {
const {href, innerText} = item;
const data = {
channelID: "",
title: "",
userID: "",
if (href.includes('channel')) {
data.channelID = href.replace("","");
} else if (href.includes('user')) {
data.userID = href.replace('',"");
data.title = innerText.split('\n')[0];
OPMLLine = `<outline type="rss" xmlUrl="${data.channelID + data.userID}"/>\n`;
output += OPMLLine;
output += '</outline>\n</body>\n</opml>'
return output;
Copy link

asorel1942 commented Nov 16, 2020

Yep, that's actually what I've been doing since my last comment. The HTML tag needed seems to be. <outline title="Youtube Subscriptions" text="Youtube Subscriptions"> </outline>, wrapped around the feeds.

Copy link

After some testing manually adding those tags to the output of your script does seem to work fine, so if you want to add that to your script feel free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment