JSFiddle - React, Tailwind, and code Playground

by yuriy636

HTML

<div id="jsonContent"></div>

JavaScript

$(function () {
var $content = $('#jsonContent');
var data = {
    rss_url: 'https://medium.com/feed/@femalefounderssg'
};
$.get('https://api.rss2json.com/v1/api.json', data, function (response) {
    if (response.status == 'ok') {
        var output = '';
        $.each(response.items, function (k, item) {
            var tagIndex = item.description.indexOf('<img', item.description.indexOf('<img') + 1); // Find where the img tag starts
            var srcIndex = item.description.substring(tagIndex).indexOf('src=') + tagIndex; // Find where the src attribute starts
            var srcStart = srcIndex + 5; // Find where the actual image URL starts; 5 for the length of 'src="'
            var srcEnd = item.description.substring(srcStart).indexOf('"') + srcStart; // Find where the URL ends
            var src = item.description.substring(srcStart, srcEnd); // Extract just the URL
            output += '<div><img src="' + src + '"></div>';
            output += '</div></div></div>';
            return k < 3;
        });
        $content.html(output);
    }
  });
});