rss-parser
Advanced tools
Comparing version 2.5.2 to 2.6.0
55
index.js
@@ -40,3 +40,4 @@ var Entities = require("entities"); | ||
'explicit', | ||
'duration' | ||
'duration', | ||
'image' | ||
]; | ||
@@ -146,14 +147,24 @@ | ||
entry = {}; | ||
json.feed.itunes = {} | ||
if (channel['itunes:owner']) { | ||
json.feed.itunes = { | ||
owner: { | ||
name: channel['itunes:owner'][0]['itunes:name'][0], | ||
email: channel['itunes:owner'][0]['itunes:email'][0] | ||
}, | ||
image: channel['itunes:image'][0].$.href | ||
}; | ||
} else { | ||
json.feed.itunes = {} | ||
var owner = {}, | ||
image; | ||
if(channel['itunes:owner'][0]['itunes:name']) { | ||
owner.name = channel['itunes:owner'][0]['itunes:name'][0]; | ||
} | ||
if(channel['itunes:owner'][0]['itunes:email']) { | ||
owner.email = channel['itunes:owner'][0]['itunes:email'][0]; | ||
} | ||
if(channel['itunes:image']) { | ||
image = channel['itunes:image'][0].$.href | ||
} | ||
if(image) { | ||
json.feed.itunes.image = image; | ||
} | ||
json.feed.itunes.owner = owner; | ||
} | ||
PODCAST_TOP_FIELDS.forEach(function(f) { | ||
@@ -166,3 +177,9 @@ if (channel['itunes:' + f]) json.feed.itunes[f] = channel['itunes:' + f][0]; | ||
entry.itunes = entry.itunes || {}; | ||
if (item['itunes:' + f]) entry.itunes[f] = item['itunes:' + f][0]; | ||
if (item['itunes:' + f]) { | ||
if (f == 'image' && item['itunes:' + f][0].$ && item['itunes:' + f][0].$.href) { | ||
entry.itunes[f] = item['itunes:' + f][0].$.href; | ||
} else { | ||
entry.itunes[f] = item['itunes:' + f][0]; | ||
} | ||
} | ||
}); | ||
@@ -186,3 +203,10 @@ json.feed.entries[index] = entry; | ||
Parser.parseURL = function(feedUrl, callback) { | ||
Parser.parseURL = function(feedUrl, settings, callback) { | ||
if (!callback) { | ||
callback = settings; | ||
settings = {}; | ||
} | ||
settings.__redirectCount = settings.__redirectCount || 0; | ||
if (settings.maxRedirects === undefined) settings.maxRedirects = 1; | ||
var xml = ''; | ||
@@ -197,3 +221,8 @@ var get = feedUrl.indexOf('https') === 0 ? HTTPS.get : HTTP.get; | ||
}, function(res) { | ||
if (res.statusCode >= 300) return callback(new Error("Status code " + res.statusCode)) | ||
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers['location']) { | ||
if (settings.maxRedirects === 0) return callback(new Error("Status code " + res.statusCode)); | ||
if (settings.__redirectCount === settings.maxRedirects) return callback(new Error("Too many redirects")); | ||
settings.__redirectCount++; | ||
return Parser.parseURL(res.headers['location'], settings, callback); | ||
} | ||
res.setEncoding('utf8'); | ||
@@ -200,0 +229,0 @@ res.on('data', function(chunk) { |
{ | ||
"name": "rss-parser", | ||
"version": "2.5.2", | ||
"version": "2.6.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -61,2 +61,3 @@ # rss-parser | ||
grunt browserify | ||
git commit -a -m "browserify" | ||
npm version minor # or major/patch | ||
@@ -63,0 +64,0 @@ npm publish |
@@ -22,3 +22,4 @@ { | ||
"explicit": "no", | ||
"duration": "74" | ||
"duration": "74", | ||
"image": "http://example.com/someImage.jpg" | ||
} | ||
@@ -25,0 +26,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1091945
28
15939
67
11
6