// Function to fetch RSS feed and display it
async function fetchAndDisplayRSS() {
const corsProxy = https://cors-anywhere.herokuapp.com/;
const feedUrl = https://rismediacontentsolutions.com/feeds/AYmhmbHVSRHhXUVhpU29ETXZUS2MrUT09/websitefeed.rss;
const url = corsProxy + feedUrl;
try {
// Fetch the RSS feed data
const response = await fetch(url);
const text = await response.text();
// Parse the RSS feed to XML
const parser = new DOMParser();
const xml = parser.parseFromString(text, "application/xml");
// Get the feed items and loop through them
const items = xml.querySelectorAll("item");
let html = "
- ";
- ${title}
items.forEach(item => {
const title = item.querySelector("title").textContent;
const link = item.querySelector("link").textContent;
html += `
`;
});
html += "
";
// Display the feed items
document.getElementById("rss-feed-container").innerHTML = html;
} catch (error) {
console.error("Failed to fetch RSS feed:", error);
}
}
// Call the function to fetch and display the RSS feed
fetchAndDisplayRSS();