JSFiddle - React, Tailwind, and code Playground

by soparrissays

HTML

<div id="content"></div>

JavaScript

var maxEntries = 0; // if 0 then there will be no limit

function newFeed(file) {
 $.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22"+encodeURIComponent(file)+"%22&format=json&callback=?", function(d) {
  var count = 0;
  //grab ever rss item from the json result request
  $(d.query.results.RDF.item).each(function() {
    //if set up to be infinite or the limit is not reached, keep grabbing items
    if(maxEntries == 0 || maxEntries>count){
     var title = this.title[1];
     var link = this.link;
     var description = this.description;
     var pubDate = this.date;
     // Format however you want, I only went for link and title
     var anItem = "<a href='"+link+"' target='_blank'>"+title+"</a><br>";
     //append to the div
     $("#content").append(anItem);
     count++;
    }
   });
 });
};

newFeed("http://sfbay.craigslist.org/muc/index.rss");