feat: add 华东理工继续教育学院新闻公告; (#8843)
Co-authored-by: jialinghui <mail@jialinghui.com>
This commit is contained in:
parent
9171173443
commit
6371054f61
|
|
@ -1050,6 +1050,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
<Route author="sushengmao" example="/ecustyjs" path="/ecustyjs" />
|
||||
|
||||
### 华东理工继续教育学院新闻公告
|
||||
|
||||
<Route author="jialinghui" example="/ecust-jxjy/news" path="/news" rssbud="1" />
|
||||
|
||||
## 华东师范大学
|
||||
|
||||
### 华东师范大学研究生院
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/ecust-jxjy/news': ['jialinghui'],
|
||||
};
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const baseURL = 'https://jxjy.ecust.edu.cn/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = baseURL + 'yeDaZhuanLan.aspx?pk=153';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const list = $('#main .enro_content>dl');
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(async (i, item) => {
|
||||
item = $(item);
|
||||
const link = baseURL + item.find('a').attr('href');
|
||||
const description = await ctx.cache.tryGet(link, async () => {
|
||||
const result = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(result.data);
|
||||
|
||||
return $('#articlepanel').html();
|
||||
});
|
||||
return {
|
||||
title: item.find('a').text().trim(),
|
||||
pubDate: timezone(parseDate(item.find('dd').text().trim(), 'YYYY/MM/DD'), +8),
|
||||
link,
|
||||
description,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '华东理工继续教育学院',
|
||||
description: '新闻公告',
|
||||
link: baseURL,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'jxjy.ecust.edu.cn': {
|
||||
_name: '华东理工继续教育学院',
|
||||
'.': [
|
||||
{
|
||||
title: '新闻公告',
|
||||
docs: 'https://docs.rsshub.app/university.html#hua-dong-li-gong-ji-xu-jiao-yu-xue-yuan',
|
||||
source: '/yeDaZhuanLan.aspx?pk=153',
|
||||
target: '/ecust-jxjy/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/news', require('./news'));
|
||||
};
|
||||
Loading…
Reference in New Issue