jameslawler / react-native-rss-parser

React Native compatible package to parse RSS feeds
MIT License
86 stars 42 forks source link

The "authors" array is always empty #2

Closed christianlundberg closed 6 years ago

christianlundberg commented 6 years ago

I'm currently using the library to parse this rss feed: http://www.puentes.me/feed/podcast

The problem is that the items always have their authors array empty.

jameslawler commented 6 years ago

Thank you @clundberg1 for the feedback. The RSSv2 parser I have written only parses RSS elements that follow the RSS v2.0 specification at the moment. In the url you provided the author element is under the itunes namespace, so it is ignored.

I would like to add support for these elements though as they are popular in RSS feeds but I need to think how to handle them. At the moment I can think of two options;

  1. Merge the itunes elements with normal RSS elements - but then what happens if there is a normal title and an itunes title? and what about itunes only elements (eg itunes:explicit)
  2. Add an itunes object to each item and it contains its own itunes specific properties. Eg
{
   items: [{
      title: 'My title',
      itunes: {
         title: 'My itunes title',
         authors: [{
            name: 'John Smith'
         }],
         explicit: 'no'
      }
   }]
}

I prefer the second option, but then it would mean as a user you would need to first look at the normal authors array and if it is empty then look for the itunes authors array.

christianlundberg commented 6 years ago

@jameslawler

I agree, I think the second option is better. It shouldn't break any previous implementation. Anyway, thanks for the quick response, and great library btw.

jameslawler commented 6 years ago

@clundberg1 I have released version 1.1.0 to the npm registry. It now supports itunes elements in both RSS and ATOM feeds. The new parsing code is covered by tests to ensure it is working. I have also updated the README file with information about the updated returned model.

Can you please try it out and let me know, then I will close this issue.

christianlundberg commented 6 years ago

@jameslawler It works correctly, you can close this now. Thanks a lot!