import axios from 'axios'; import xml2js from 'xml2js'; class RssService { async getRssFeed(url) { try { const response = await axios.get(url); const result = await xml2js.parseStringPromise(response.data, { mergeAttrs: true }); return result.rss.channel[0].item; } catch (error) { console.error('Error fetching RSS feed:', error); return []; } } } const rssService = new RssService(); export default rssService;