mirror of
https://gitlab.silvrtree.co.uk/martind2000/rss-braider.git
synced 2025-02-10 20:39:15 +00:00
Fixing thumbnail issue and unit test
This commit is contained in:
parent
b8d8d12d79
commit
8fe8f3a175
@ -55,7 +55,7 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
||||
if (url) {
|
||||
var req = request(url);
|
||||
|
||||
logger.info("request to", url);
|
||||
// logger.info("request to", url);
|
||||
|
||||
req.on('error', function (error) {
|
||||
logger.error(error);
|
||||
@ -202,8 +202,12 @@ RssBraider.prototype.processItem = function (item) {
|
||||
// 'media:content'[0]'media:thumbnail'
|
||||
// else
|
||||
// 'media:thumbnail'
|
||||
var thumbnail;
|
||||
if (item['media:thumbnail'] && item['media:thumbnail']['#']) {
|
||||
itemOptions.custom_elements.push({'media:thumbnail' : item['media:thumbnail']['#']});
|
||||
thumbnail = {
|
||||
'media:thumbnail': item['media:thumbnail']['#']
|
||||
};
|
||||
itemOptions.custom_elements.push(thumbnail);
|
||||
} else {
|
||||
if (item["media:content"]) {
|
||||
var media_contents;
|
||||
@ -218,10 +222,24 @@ RssBraider.prototype.processItem = function (item) {
|
||||
media_contents[0]['media:thumbnail']['@'] &&
|
||||
media_contents[0]['media:thumbnail']['@'].url) {
|
||||
|
||||
itemOptions.custom_elements.push({'media:thumbnail' : media_contents[0]['media:thumbnail']['@'].url});
|
||||
|
||||
thumbnail = {
|
||||
'media:thumbnail' : [{
|
||||
_attr: {
|
||||
url: media_contents[0]['media:thumbnail']['@'].url
|
||||
}
|
||||
}]
|
||||
};
|
||||
// itemOptions.custom_elements.push({'media:thumbnail' : { url: media_contents[0]['media:thumbnail']['@'].url}} );
|
||||
itemOptions.custom_elements.push(thumbnail);
|
||||
} else {
|
||||
itemOptions.custom_elements.push({'media:thumbnail' : media_contents[0]['@'].url});
|
||||
thumbnail = {
|
||||
'media:thumbnail' : [{
|
||||
_attr: {
|
||||
url: media_contents[0]['@'].url
|
||||
}
|
||||
}]
|
||||
};
|
||||
itemOptions.custom_elements.push(thumbnail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,8 @@
|
||||
<div id='ctx-module' class='ctx-module-container ctx-clearfix'></div>]]></content:encoded>
|
||||
<wfw:commentRss>http://ww2.kqed.org/arts/2014/12/20/rent-hike-for-dance-mission-theater-has-artists-worried-about-uncertain-future/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
<media:thumbnail>http://ww2.kqed.org/arts/wp-content/uploads/sites/2/2014/12/10232900-thumb.jpg</media:thumbnail>
|
||||
<media:thumbnail url="http://ww2.kqed.org/arts/wp-content/uploads/sites/2/2014/12/10232900-thumb.jpg">
|
||||
</media:thumbnail>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
Loading…
Reference in New Issue
Block a user