Quantcast
Channel: How to parse an RSS feed using JavaScript? - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by Chetabahana for How to parse an RSS feed using JavaScript?

$
0
0

If you are looking for a simple and free alternative to Google Feed API for your rss widget then rss2json.com could be a suitable solution for that.

You may try to see how it works on a sample code from the api documentation below:

google.load("feeds", "1");    function initialize() {      var feed = new google.feeds.Feed("https://news.ycombinator.com/rss");      feed.load(function(result) {        if (!result.error) {          var container = document.getElementById("feed");          for (var i = 0; i < result.feed.entries.length; i++) {            var entry = result.feed.entries[i];            var div = document.createElement("div");            div.appendChild(document.createTextNode(entry.title));            container.appendChild(div);          }        }      });    }    google.setOnLoadCallback(initialize);
<html><head>    <script src="https://rss2json.com/gfapi.js"></script></head><body><p><b>Result from the API:</b></p><div id="feed"></div></body></html>

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>