Finding RSS Links on Websites

Sup fellow diver, here’s a simple copypastatut on how to use vanilla JavaScript to get RSS links from a webpage’s HTML documents and output them in the console of your browser. The script basically uses getElementsByTagName("link") to select all link elements in the document, then iterates over them to find the ones with an attribute type="application/rss+xml". When it finds such link attributes, it then prints out the href attribute of the link, which is the RSS feed URL.

Here are the steps:

  1. Open the webpage from which you wish to find RSS links
  2. Right-click on the page, and select “Inspect” or “Inspect Element” based on your browser. (Its Ctrl + Shift + i on Windows and Linux, and Ctrl + Shift + i on macOS, direct console access shortcut is Ctrl + Shift + j).
  3. A developer console will open, generally on the bottom or right side of the browser window. At the top of this console, there are several tabs. Pick Console.
  4. Inside the “Console”, either on the bottom or right-hand side, you will see a blinking cursor where you can paste and run JavaScript code.
  5. Now, copy and paste the following JavaScript code into the console:
var links = document.getElementsByTagName("link");

for(var i = 0; i < links.length; i++) {
    var link = links[i];
    var linkType = link.getAttribute("type");

    if(linkType === "application/rss+xml" || linkType === "application/rdf+xml" || linkType === "application/atom+xml") {
        console.log(link.getAttribute("href"));
    }
}
  1. Press Enter to run that shit.
  2. The console will now print out all the URLs to the RSS feeds available on the webpage.

There you go, no go explore.

ender