Rinser/plugins/kill_unwanted_images.js
2016-04-08 10:12:43 +01:00

33 lines
547 B
JavaScript

var cheerio = require('cheerio');
module.exports = function (item, itemOptions, source) {
// This plugin does no processing
// It's just a template
var $ = cheerio.load(itemOptions.description, {
normalizeWhitespace: true,
xmlMode: true
});
var tdihbody = $(":root");
if (tdihbody.length > 0)
{
try {
tdihbody.find('IMG').each(function (i, elem) {
var s, src = $(this).attr("src");
console.log(src);
});
}
catch (e) {
logger.error(e);
}
}
return itemOptions;
};