Skip to content

Commit 5ed4cda

Browse files
authored
feat(route): add 南昌大学教务处 (#13973)
* 添加了新的RSSHub路由,支持Radar ,以及修改了对应的文档 新增了针对南昌大学教务处通知的RSSHub路由,支持Radar。 同时修改了RSShub文档 * Removed redundant settings and fixed the year. 删去了多余的代码,更正了正确的年份
1 parent 226ed36 commit 5ed4cda

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

lib/v2/ncu/jwc.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const got = require('@/utils/got'); // 自订的 got
2+
const cheerio = require('cheerio'); // 可以使用类似 jQuery 的 API HTML 解析器
3+
const { parseDate } = require('@/utils/parse-date');
4+
5+
module.exports = async (ctx) => {
6+
const baseUrl = "https://jwc.ncu.edu.cn";
7+
const response = await got(baseUrl);
8+
const $ = cheerio.load(response.body);
9+
10+
const list = $(".box3 .inner ul.img-list li");
11+
12+
ctx.state.data = {
13+
title: "南昌大学教务处",
14+
link: baseUrl,
15+
description: "南昌大学教务处",
16+
item:
17+
list &&
18+
list.toArray().map((item) => {
19+
const el = $(item);
20+
const linkEl = el.find("a");
21+
const date = el.text().split("】")[0].replace("【", "").trim();
22+
const title = linkEl.attr("title");
23+
const link = `${baseUrl}/${linkEl.attr("href")}`;
24+
const month = date.slice(0, 2);
25+
26+
return {
27+
title,
28+
link,
29+
pubDate: parseDate(date, 'MM-DD').setFullYear(month < 6 ? new Date().getFullYear() - 1 : new Date().getFullYear()),
30+
};
31+
}),
32+
};
33+
};

lib/v2/ncu/maintainer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'/jwc': ['ywh555hhh'],
3+
};

lib/v2/ncu/radar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
'ncu.edu.cn': {
3+
_name: '南昌大学',
4+
'.': [
5+
{
6+
title: '教务通知',
7+
docs: 'https://docs.rsshub.app/routes/university#nan-chang-da-xue',
8+
source: ['/', '/jwtz/index.htm'],
9+
target: '/ncu/jwc',
10+
},
11+
],
12+
},
13+
};

lib/v2/ncu/router.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = function (router) {
2+
router.get('/jwc', require('./jwc'));
3+
4+
};

website/docs/routes/university.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,12 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
21082108

21092109
</Route>
21102110

2111+
## 南昌大学 {#nan-chang-da-xue}
2112+
2113+
### 教务通知 {#nan-chang-da-xue--jiao-wu-tong-zhi}
2114+
2115+
<Route author="ywh555hhh" example="/ncu/jwc" path="/ncu/jwc" radar="1" />
2116+
21112117
## 南昌航空大学 {#nan-chang-hang-kong-da-xue}
21122118

21132119
### 教务处公告与新闻 {#nan-chang-hang-kong-da-xue-jiao-wu-chu-gong-gao-yu-xin-wen}

0 commit comments

Comments
 (0)