43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
|
|
module.exports = async (ctx) => {
|
|
const baseUrl = 'https://ciee.cau.edu.cn';
|
|
const link = `${baseUrl}/col/col26712/index.html`;
|
|
const response = await got(`${baseUrl}/module/web/jpage/dataproxy.jsp`, {
|
|
searchParams: {
|
|
page: 1,
|
|
appid: 1,
|
|
webid: 107,
|
|
path: '/',
|
|
columnid: 26712,
|
|
unitid: 38467,
|
|
webname: '信息与电气工程学院',
|
|
permissiontype: 0,
|
|
},
|
|
});
|
|
const $ = cheerio.load(response.data);
|
|
const list = $('recordset record');
|
|
|
|
ctx.state.data = {
|
|
title: '中国农业大学信电学院',
|
|
link,
|
|
description: '中国农业大学信电学院通知公告',
|
|
item:
|
|
list &&
|
|
list.toArray().map((item) => {
|
|
item = $(item);
|
|
const a = item.find('a');
|
|
const title = a.attr('title');
|
|
const link = `${baseUrl}${a.attr('href')}`;
|
|
return {
|
|
title,
|
|
link,
|
|
pubDate: parseDate(item.find('.col-lg-1').text()),
|
|
guid: `${link}#${title}`,
|
|
};
|
|
}),
|
|
};
|
|
};
|