Skip to content

Instantly share code, notes, and snippets.

@Nitrousoxide
Last active June 30, 2023 20:39
Show Gist options
  • Save Nitrousoxide/10cf5e78bc965887ba723a63d1daf0fa to your computer and use it in GitHub Desktop.
Save Nitrousoxide/10cf5e78bc965887ba723a63d1daf0fa to your computer and use it in GitHub Desktop.
Mastodon RSS Generator
javascript:(function() {
/*Create a new bookmark in your web browser.
Edit the bookmark and replace the URL with the generated JavaScript code above.
Save the bookmark.
Navigate to the Mastodon feed page for which you want to extract the RSS URL.
Click on the bookmark you just created.*/
var feedUrl = window.location.href;
if (feedUrl.includes("/@")) {
var server = feedUrl.split("/@")[0];
var usernameAndServer = feedUrl.split("/@")[1];
var username = usernameAndServer.split("@")[0];
var serverPart = usernameAndServer.split("@")[1] || server;
if (!serverPart.startsWith("http://") && !serverPart.startsWith("https://")) {
serverPart = "https://" + serverPart;
}
var rssUrl = serverPart + "/@" + username + ".rss";
window.location.href = rssUrl;
} else {
alert("Invalid Mastodon feed URL!");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment