feedparser
Advanced tools
Comparing version 2.0.0 to 2.1.0
2.1.0 / 2017-01-18 | ||
================== | ||
* Keep optional media:content attributes in the enclosures default property | ||
2.0.0 / 2016-12-26 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -917,2 +917,3 @@ /********************************************************************** | ||
case('media:content'): | ||
var optionalAttributes = ['bitrate', 'framerate', 'samplingrate', 'duration', 'height', 'width']; | ||
if (Array.isArray(el)) { | ||
@@ -924,3 +925,12 @@ el.forEach(function (enc){ | ||
enclosure.length = _.get(enc['@'], 'filesize'); | ||
if (indexOfObject(item.enclosures, enclosure, ['url', 'type']) === -1) { | ||
var index = indexOfObject(item.enclosures, enclosure, ['url', 'type']); | ||
if (index !== -1) { | ||
enclosure = item.enclosures[index]; | ||
} | ||
optionalAttributes.forEach(function (attribute) { | ||
if (!enclosure[attribute] && _.get(enc['@'], attribute)) { | ||
enclosure[attribute] = _.get(enc['@'], attribute); | ||
} | ||
}); | ||
if (index === -1) { | ||
item.enclosures.push(enclosure); | ||
@@ -934,3 +944,12 @@ } | ||
enclosure.length = _.get(el['@'], 'filesize'); | ||
if (indexOfObject(item.enclosures, enclosure, ['url', 'type']) === -1) { | ||
var index = indexOfObject(item.enclosures, enclosure, ['url', 'type']); | ||
if (index !== -1) { | ||
enclosure = item.enclosures[index]; | ||
} | ||
optionalAttributes.forEach(function (attribute) { | ||
if (!enclosure[attribute] && _.get(el['@'], attribute)) { | ||
enclosure[attribute] = _.get(el['@'], attribute); | ||
} | ||
}); | ||
if (index === -1) { | ||
item.enclosures.push(enclosure); | ||
@@ -937,0 +956,0 @@ } |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"keywords": [ | ||
@@ -11,0 +11,0 @@ "rss", |
@@ -9,3 +9,22 @@ describe('duplicate enclosures', function(){ | ||
var stream = this; | ||
assert.strictEqual(stream.read().enclosures.length, 2); | ||
var enclosures = stream.read().enclosures; | ||
assert.strictEqual(enclosures.length, 3); | ||
assert.deepEqual(enclosures, [{ | ||
url: 'http://i.mol.im/i/pix/2013/02/03/article-2272640-174FCEE2000005DC-697_154x115.jpg', | ||
type: 'image/jpeg', | ||
length: '4114', | ||
height: '115', | ||
width: '154' | ||
}, { | ||
url: 'http://i.mol.im/i/pix/2013/02/03/article-2272640-174FCEE2000005DC-697_154x115.mp4', | ||
type: 'video/mp4', | ||
length: '4114' | ||
}, { | ||
url: 'http://i.mol.im/i/pix/2013/02/03/article-2272640-174FCEE2000005DC-697.mp4', | ||
type: 'video/mp4', | ||
length: null, | ||
bitrate: '3000', | ||
height: '115', | ||
width: '154' | ||
}]); | ||
done(); | ||
@@ -12,0 +31,0 @@ }) |
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
460015
46
2065
10
6