diff --git a/README.md b/README.md index 5fcf5cc56..3f68f8407 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 - 展览信息 - 马蜂窝 - 游记 +- 江南大学 + - 教务处通知 diff --git a/docs/README.md b/docs/README.md index 6026ee9b1..acb2a969b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1973,6 +1973,26 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运 type,必选,目前支持两种,`hot` 代表热门游记,`latest` 代表最新游记 +## 江南大学 + +### 教务处通知 + +举例: [https://rsshub.app/ju/jwc/all](https://rsshub.app/ju/jwc/all) + +路由: `/ju/jwc/:type?` + +参数: + +type, 可选, 默认为 `all` + +| all | tzgg | ksap | wjgg | tmgz | djks | xjgl | bysj | syjs | +| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | +| 全部 | 通知公告 | 考试安排 | 违纪公告 | 推免工作 | 等级考试 | 学籍管理 | 毕业设计 | 实验教学 | + +| sjcx | xkjs | yjszj | jxgg | zyjs | kcjs | jcjs | jxcg | xsbg | +| -------- | -------- | ---------- | -------- | -------- | -------- | -------- | -------- | -------- | +| 实践创新 | 学科竞赛 | 研究生助教 | 教学改革 | 专业建设 | 课程建设 | 教材建设 | 教学成果 | 学术报告 | + ## 中国地震局 ### 地震速报 diff --git a/router.js b/router.js index 3aaf63681..3e05c7054 100755 --- a/router.js +++ b/router.js @@ -434,6 +434,9 @@ router.get('/wechat/wasi/:id', require('./routes/wechat/wasi')); // 马蜂窝 router.get('/mafengwo/note/:type', require('./routes/mafengwo/note')); +// 江南大学 +router.get('/ju/jwc/:type?', require('./routes/ju/jwc')); + // 中国地震局震情速递(与地震台网同步更新) router.get('/earthquake', require('./routes/earthquake')); diff --git a/routes/ju/jwc.js b/routes/ju/jwc.js new file mode 100644 index 000000000..42a57b2c4 --- /dev/null +++ b/routes/ju/jwc.js @@ -0,0 +1,51 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); +const resolve_url = require('url').resolve; + +const base_url = 'http://jwc.jiangnan.edu.cn'; + +const map = { + all: '/', + tzgg: '/jwgl/tzgg.htm', + ksap: '/jwgl/ksap.htm', + wjgg: '/jwgl/wjgg.htm', + tmgz: '/jwgl/tmgz.htm', + djks: '/jwgl/djks.htm', + xjgl: '/xjgl1.htm', + bysj: '/sjjx/bysj.htm', + syjx: '/sjjx/syjx.htm', + sjcx: '/sjjx/sjcx.htm', + xkjs: '/sjjx/xkjs.htm', + yjszj: '/sjjx/yjszj.htm', + jxgg: '/jxjs/jxgg.htm', + zyjs: '/jxjs/zyjs.htm', + kcjs: '/jxjs/kcjs.htm', + jcjs: '/jxjs/jcjs.htm', + jxcg: '/jxjs/jxcg.htm', + xsbg: '/xsbg.htm', +}; + +module.exports = async (ctx) => { + const type = ctx.params.type || 'all'; + const link = `${base_url}${map[type]}`; + + const response = await axios({ + method: 'get', + url: link, + headers: { + Referer: link, + }, + }); + + const $ = cheerio.load(response.data); + + ctx.state.data = { + link: link, + title: $('title').text(), + item: $('.pg-list>ul>li').map((_, elem) => ({ + link: resolve_url(link, $('a', elem).attr('href')), + title: $('a', elem).text(), + pubDate: new Date($('span.food-time', elem).text()).toUTCString(), + })), + }; +};