fix(route): add pubDate for 中国教育考试网 (#7088)
Co-authored-by: rs <rs@rs-tower20>
This commit is contained in:
@@ -28,15 +28,20 @@ module.exports = async (ctx) => {
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $(`#ReportIDname > a`).get();
|
||||
const list = $(`#ReportIDname > a`).parent().parent().get();
|
||||
|
||||
const process = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const itemUrl = `http://${type}.neea.edu.cn` + $(item).attr('href');
|
||||
const ReportIDname = $(item).find('#ReportIDname > a');
|
||||
const ReportIDIssueTime = $(item).find('#ReportIDIssueTime');
|
||||
const itemUrl = `http://${type}.neea.edu.cn` + $(ReportIDname).attr('href');
|
||||
let time = new Date(ReportIDIssueTime.text()).getTime();
|
||||
time += new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000; // beijing timezone
|
||||
const single = {
|
||||
title: $(item).text(),
|
||||
title: $(ReportIDname).text(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
pubDate: new Date(time).toUTCString(),
|
||||
};
|
||||
const other = await load(String(itemUrl), ctx);
|
||||
return Promise.resolve(Object.assign({}, single, other));
|
||||
|
||||
Reference in New Issue
Block a user