/*import { dlog, dnetwork, TObject } from "."; /// ISSUE with nodejs http and https const xml2js = require("xml2js"); export namespace drss { export type TRssItem = { title: string; url: string; contentSnippet?: string; date: Date; image?: string; source?: string; }; export async function getRSSFeed(url: string, mapper?: TObject): Promise { let feed = await dnetwork.get(url); let data = await xml2js.parseStringPromise(feed, { mergeAttrs: true }); let mapper1: TObject = { date: "isoDate", title: "title", contentSnippet: "contentSnippet", url: "link", image: "image", source: "creator", }; let result: TRssItem[] = []; for (let u of feed.items) { result.push({ title: u[mapper1.title] as string, url: u[mapper1.url] as string, contentSnippet: u[mapper1.contentSnippet] as string, date: new Date(u[mapper1.date]), image: u[mapper1.image] as string, source: u[mapper1.source] as string, }); } return result; } } (async () => { dlog.obj(await drss.getRSSFeed("https://www.zeebiz.com/world-economy.xml")); //dlog.obj(await drss.getRSSFeed("http://feeds.marketwatch.com/marketwatch/topstories/")); //dlog.obj(await drss.getRSSFeed("https://www.moneycontrol.com/rss/MCtopnews.xml")); })(); // issue with NODEJS */