rbren / rss-parser

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

cannot fetch same attribute multiple times #190

Open lakshminarasimhan93 opened 3 years ago

lakshminarasimhan93 commented 3 years ago

I am trying to fetch attribute which is repeated multiple times, consider this example

    <entry>
    <link rel="enclosure" type="image/jpeg" href="https://assets.wam.ae/uploads/2021/01/thumbnail-362163802411229244.jpg" />
    <link rel="alternate" type="text/html" href="http://wam.ae/en/details/1395302905328"></link>
    </entry>

I want to retrieve the link tag with rel="enclosure" attribute, I have tried using custom fields option , but unable to fetch

 let rssParser = new RssParser({
      customFields: {
         item:['link', {keepArray: true}],
      }
 });
lakshminarasimhan93 commented 3 years ago

I am trying to fetch attribute which is repeated multiple times, consider this example

    <entry>
    <link rel="enclosure" type="image/jpeg" href="https://assets.wam.ae/uploads/2021/01/thumbnail-362163802411229244.jpg" />
    <link rel="alternate" type="text/html" href="http://wam.ae/en/details/1395302905328"></link>
    </entry>

I want to retrieve the link tag with rel="enclosure" attribute, I have tried using custom fields option , but unable to fetch

 let rssParser = new RssParser({
      customFields: {
         item:['link', {keepArray: true}],
      }
 });

its working now , seems that I have missed out logic in my code