react-native-rss-parser
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "react-native-rss-parser", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "React Native compatible package to parse RSS feeds", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,1 +0,2 @@ | ||
exports.itunes = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; | ||
exports.itunes = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; | ||
exports.content = 'http://purl.org/rss/1.0/modules/content/'; |
var utils = require('./utils'); | ||
var model = require('../model/rss'); | ||
var namespaces = require('./namespaces'); | ||
var itunesParser = require('./itunes'); | ||
@@ -137,2 +138,6 @@ | ||
function getItemContent(node) { | ||
return utils.getElementTextContent(node, 'encoded', namespaces.content); | ||
} | ||
function getItemAuthors(node) { | ||
@@ -186,2 +191,3 @@ const authors = utils.getElementTextContentArray(node, 'author'); | ||
description: getItemDescription(item), | ||
content: getItemContent(item), | ||
id: getItemId(item), | ||
@@ -188,0 +194,0 @@ authors: getItemAuthors(item), |
@@ -141,14 +141,14 @@ # react-native-rss-parser | ||
| Parsed Value | RSS v2.0 | Atom v1.0 | | ||
| ------------- | ------------- | ------------- | | ||
| id | guid | id | | ||
| title | title | title | | ||
| imageUrl | | icon | | ||
| links | link | link | | ||
| description | description | summary | | ||
| content | | content | | ||
| categories | category | category | | ||
| authors | author | contributor | | ||
| published | pubDate | published | | ||
| enclosures | enclosures | link | | ||
| Parsed Value | RSS v2.0 | Atom v1.0 | | ||
| ------------- | --------------- | ------------- | | ||
| id | guid | id | | ||
| title | title | title | | ||
| imageUrl | | icon | | ||
| links | link | link | | ||
| description | description | summary | | ||
| content | content:encoded | content | | ||
| categories | category | category | | ||
| authors | author | contributor | | ||
| published | pubDate | published | | ||
| enclosures | enclosures | link | | ||
@@ -155,0 +155,0 @@ ## Development setup |
@@ -7,2 +7,3 @@ var assert = require('assert'); | ||
var rssv2WithItunes = require('./samples/rssv2-with-itunes'); | ||
var rssv2WithContent = require('./samples/rssv2-with-content'); | ||
var rssParser = require('../index'); | ||
@@ -37,2 +38,3 @@ | ||
assert.equal(result.items[0].enclosures[0].mimeType, 'audio/mpeg'); | ||
assert.equal(result.items[0].content, undefined); | ||
assert.equal(result.items[1].published, 'Sun, 29 Sep 2002 19:59:01 GMT'); | ||
@@ -107,2 +109,12 @@ }); | ||
describe('with content:encoded elements', function() { | ||
it('should return content information for item elements', function() { | ||
return rssParser.parse(rssv2WithContent.feed) | ||
.then((result) => { | ||
assert.equal(result.items[0].content, 'This is test item 1'); | ||
assert.equal(result.items[1].content, 'This is test item 2'); | ||
}); | ||
}); | ||
}); | ||
describe('invalid document', function() { | ||
@@ -109,0 +121,0 @@ it('should reject promise', function() { |
117506
23
1589