fix: change cache strategy of 色花堂 (#4088)

This commit is contained in:
junfengP
2020-02-27 00:39:16 +08:00
committed by GitHub
parent 3459b5755e
commit 9fffa7fc1b
+4 -2
View File
@@ -97,7 +97,7 @@ module.exports = async (ctx) => {
$(images[k]).replaceWith(`<img src="${$(images[k]).attr('file')}" />`);
}
}
const description = (postMessage.html() || '原帖已被删除').replace(/ignore_js_op/g, 'div');
const description = (postMessage.html() || '抓取原帖失败').replace(/ignore_js_op/g, 'div');
const enclosureUrl = postMessage.find('div.blockcode li').text();
const single = {
@@ -108,7 +108,9 @@ module.exports = async (ctx) => {
enclosure_url: enclosureUrl,
enclosure_type: 'application/x-bittorrent',
};
ctx.cache.set(itemUrl, JSON.stringify(single));
if (description !== '抓取原帖失败') {
ctx.cache.set(itemUrl, JSON.stringify(single));
}
return Promise.resolve(single);
})
);