fix njxzc tzgg (#11253)
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
This commit is contained in:
parent
92e675464b
commit
8b88feff0f
|
|
@ -36,15 +36,19 @@ module.exports = async (ctx) => {
|
|||
// 使用缓存
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
item.title = $('.arti_title').text();
|
||||
item.description = $('.wp_articlecontent')
|
||||
.html()
|
||||
.replace(/src="\//g, `src="${new URL('.', host).href}`)
|
||||
.replace(/href="\//g, `href="${new URL('.', host).href}`)
|
||||
.trim();
|
||||
item.pubDate = timezone(parseDate($('.arti_update').text().replace('发布时间:', '')), +8);
|
||||
|
||||
if (response.redirectUrls.length > 0) {
|
||||
item.link = response.redirectUrls[0];
|
||||
item.description = '该通知无法直接预览,请点击原文链接↑查看';
|
||||
} else {
|
||||
const $ = cheerio.load(response.data);
|
||||
item.title = $('.arti_title').text();
|
||||
item.description = $('.wp_articlecontent')
|
||||
.html()
|
||||
.replace(/src="\//g, `src="${new URL('.', host).href}`)
|
||||
.replace(/href="\//g, `href="${new URL('.', host).href}`)
|
||||
.trim();
|
||||
item.pubDate = timezone(parseDate($('.arti_update').text().replace('发布时间:', '')), +8);
|
||||
}
|
||||
return item;
|
||||
})
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue