mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat: filter out articles which require permission (#2698)
in NJTECH jwc
This commit is contained in:
@@ -34,16 +34,20 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
const response = await got.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const single = {
|
||||
title: $('#mainRight .title').text(),
|
||||
link: itemUrl,
|
||||
description: $('#vsb_content').html(),
|
||||
pubDate: $('.time')
|
||||
.text()
|
||||
.match(/(\d{4}-\d{2})-\d{2}/)[0],
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
const targetDate = $('.time')
|
||||
.text()
|
||||
.match(/(\d{4}-\d{2})-\d{2}/);
|
||||
|
||||
if (targetDate) {
|
||||
const single = {
|
||||
title: $('#mainRight .title').text(),
|
||||
link: itemUrl,
|
||||
description: $('#vsb_content').html(),
|
||||
pubDate: targetDate[0],
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
}
|
||||
})
|
||||
);
|
||||
const info = '教务公告';
|
||||
@@ -51,6 +55,6 @@ module.exports = async (ctx) => {
|
||||
ctx.state.data = {
|
||||
title: '南京工业大学教务处 - ' + info,
|
||||
link,
|
||||
item: out,
|
||||
item: out.filter((i) => i),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user