Last active
June 30, 2023 20:39
-
-
Save Nitrousoxide/10cf5e78bc965887ba723a63d1daf0fa to your computer and use it in GitHub Desktop.
Mastodon RSS Generator
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() { | |
/*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