feat(route): add 厦门理工大学教务处 (#13326)
* Add XMUT 教务处 * Add parseDate feature * Update bkjw.js * Update bkjw.js * Update maintainer.js * Update bkjw.js * Update bkjw.js * Update website/docs/routes/university.md * Update lib/v2/xmut/maintainer.js * Update website/docs/routes/university.md * Update bkjw.js * Update yjs.js * Update yjs.js * Update bkjw.js * Update bkjw.js * Update yjs.js * Update lib/v2/xmut/radar.js ---------
This commit is contained in:
parent
8cc729ba3b
commit
bc75193bcf
|
|
@ -0,0 +1,60 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const xmut = 'https://jwc.xmut.edu.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'jwxt' } = ctx.params;
|
||||
const url = `${xmut}/index/tzgg/${category}.htm`;
|
||||
const res = await got(url, {
|
||||
headers: {
|
||||
referer: xmut,
|
||||
},
|
||||
https: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(res.data);
|
||||
const itemsArray = $('#result_list table tbody tr').map((index, row) => {
|
||||
const res = $('td', row).eq(0);
|
||||
const resDate = $('td', row).eq(1);
|
||||
const resLink = $('a', res).attr('href');
|
||||
let link;
|
||||
if (resLink.startsWith('../../')) {
|
||||
const parsedUrl = new URL(resLink, xmut);
|
||||
link = parsedUrl.href;
|
||||
} else {
|
||||
link = resLink;
|
||||
}
|
||||
const title = $('a', res).attr('title');
|
||||
const pubDate = parseDate(resDate.text().trim());
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
pubDate
|
||||
};
|
||||
}).get();
|
||||
const items = await Promise.all(
|
||||
itemsArray.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got(item.link, {
|
||||
headers: {
|
||||
referer: xmut,
|
||||
},
|
||||
https: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
});
|
||||
const $item = cheerio.load(res.data);
|
||||
const content = $item('table #result #content form div #vsb_content_6').html();
|
||||
item.description = content;
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const xmut = 'https://yjs.xmut.edu.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'yjsc' } = ctx.params;
|
||||
const url = `${xmut}/index/${category}.htm`;
|
||||
const res = await got(url, {
|
||||
headers: {
|
||||
referer: xmut,
|
||||
},
|
||||
https: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(res.data);
|
||||
const items = $('.mainWrap .main_con .main_conR ul li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('em').text(),
|
||||
link: `${xmut}/` + item.find('a').attr('href'),
|
||||
pubDate: parseDate(item.find('span').text()),
|
||||
};
|
||||
});
|
||||
const itemPromises = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got(item.link, {
|
||||
headers: {
|
||||
referer: xmut,
|
||||
},
|
||||
https: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
});
|
||||
const $item = cheerio.load(detailResponse.data);
|
||||
const content = $item('body .mainWrap .main_content .v_news_content').html();
|
||||
item.description = content;
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
item: itemPromises,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/jwc/:type/:method': ['icecliffs'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'xmut.edu.cn': {
|
||||
_name: '厦门理工学院',
|
||||
jwc: [
|
||||
{
|
||||
title: '教务处',
|
||||
docs: 'https://docs.rsshub.app/routes/university#xia-men-li-gong-da-xue',
|
||||
source: ['/:category'],
|
||||
target: (params) => `/xmut/jwc${params.category ? `/${params.category}` : ''}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/jwc/bkjw/:category?', require('./jwc/bkjw.js'));
|
||||
router.get('/jwc/yjjw/:category?', require('./jwc/yjs.js'));
|
||||
};
|
||||
|
|
@ -2507,6 +2507,22 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
<Route author="abc1763613206" example="/qdu/jwc" path="/qdu/jwc" radar="1" />
|
||||
|
||||
## 厦门理工大学 {#xia-men-li-gong-da-xue}
|
||||
|
||||
### 教务处 {#xia-men-li-gong-da-xue-jiao-wu-chu}
|
||||
|
||||
<Route author="icecliffs" example="/xmut/jwc/bkjw/jxyx" path="/xmut/jwc/:type/:method" paramsDesc={['系统类型,分为 `bkjw` 本科生教务处, `yjjw` 研究生处', '分类如下表']} >
|
||||
|
||||
| 本科生教务处 | 系统说明 | 研究生处 | 系统说明 |
|
||||
| :------: | :--------: | :--------: | :-------: |
|
||||
| jxyx | 教学运行 | tzgg | 通知公告 |
|
||||
| zhsw | 综合事务 | xwdt | 新闻动态 |
|
||||
| xwgl | 学务管理 | xstj | 学术研究 |
|
||||
| sjjx | 实践教学 | yjsjw | 工作简讯 |
|
||||
| jyjg | 教研教改 | | |
|
||||
|
||||
</Route>
|
||||
|
||||
## 清华大学 {#qing-hua-da-xue}
|
||||
|
||||
### 清华大学校内信息发布平台 {#qing-hua-da-xue-qing-hua-da-xue-xiao-nei-xin-xi-fa-bu-ping-tai}
|
||||
|
|
|
|||
Loading…
Reference in New Issue