rbren / rss-parser

A lightweight RSS parser, for Node and the browser
MIT License
1.38k stars 209 forks source link

parse media content in xml #236

Closed serhatkarakoca closed 2 years ago

serhatkarakoca commented 2 years ago

parseItemRss(xmlItem, itemFields) { let item = {}; var mediaContent = xmlItem['media:content'][0].$;

utils.copyFromXML(xmlItem, item, itemFields);
if (xmlItem.enclosure) {
  item.enclosure = xmlItem.enclosure[0].$;
}
if (xmlItem.description) {
  item.content = utils.getContent(xmlItem.description[0]);
  item.contentSnippet = utils.getSnippet(item.content);
}
if (xmlItem.guid) {
  item.guid = xmlItem.guid[0];
  if (item.guid._) item.guid = item.guid._;
}
if (xmlItem.category) item.categories = xmlItem.category;
if(mediaContent) item.mediaContent = mediaContent;
this.setISODate(item);
return item;

}