Skip to content

Commit

Permalink
fix(route): add pubDate for 中国教育考试网 (DIYgod#7088)
Browse files Browse the repository at this point in the history
Co-authored-by: rs <rs@rs-tower20>
  • Loading branch information
starry2048 and rs authored Mar 2, 2021
1 parent bfff2c5 commit 0dce8a0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/routes/neea/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0dce8a0

Please sign in to comment.