Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"Subscribe" bookmarklet for Feedly. Copy and paste the code into the "Location" field of a new bookmark.
javascript:(function() {
const YouTubeChannel = /^https:\/\/www.youtube.com\/channel\/([A-Za-z0-9_\-]+)$/;
const feedUrl = (function() {
if (
document.documentElement.id === "feedHandler" ||
document.body.childNodes[0].id == "webkit-xml-viewer-source-xml"
) {
return document.location.href;
} else if (YouTubeChannel.test(document.location.href)) {
const channelId = YouTubeChannel.exec(document.location.href)[1];
return `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`;
} else {
const element = document.querySelector(
'link[rel~="alternate"][type="application/atom+xml"], ' +
'link[rel~="alternate"][type="application/rss+xml"]'
);
if (element) {
return element.href;
}
}
})();
if (!feedUrl) {
alert("No feed found.");
return;
}
const feedlySubscriptionUrl =
"https://feedly.com/i/subscription/feed/" + encodeURIComponent(feedUrl);
window.open(feedlySubscriptionUrl, "_top");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.