fix(route): 南京大学 zcc (#10145)
* fix(route): 南京大学 zcc * fix: use parseDate
This commit is contained in:
parent
6017666563
commit
3384873ad5
|
|
@ -1,26 +1,24 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category_dict = {
|
||||
gyfytdglk: '公用房与土地管理科',
|
||||
zfglk: '住房管理科',
|
||||
xxzhk: '信息综合科',
|
||||
czcjk: '出租出借科',
|
||||
czcjk: '出租出借管理科',
|
||||
gyzcglk: '国有资产管理科',
|
||||
};
|
||||
|
||||
const items = await Promise.all(
|
||||
Object.keys(category_dict).map(async (c) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://zcc.nju.edu.cn/tzgg/${c}/index.html`,
|
||||
});
|
||||
const response = await got(`https://zcc.nju.edu.cn/tzgg/${c}/index.html`);
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
let script = $('ul.list_news_dl').find('script');
|
||||
script = script['1'].children[0].data;
|
||||
let script = $('ul.clearfix').find('script');
|
||||
script = script['2'].children[0].data;
|
||||
|
||||
const start = script.indexOf('[');
|
||||
const end = script.lastIndexOf(']');
|
||||
|
|
@ -33,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
description: item.summary,
|
||||
link: item.url,
|
||||
author: item.username,
|
||||
pubDate: new Date(item.releasetime).toUTCString(),
|
||||
pubDate: parseDate(item.releasetime, 'x'),
|
||||
category: category_dict[c],
|
||||
}))
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue