diff --git a/lib/v2/xmut/jwc/bkjw.js b/lib/v2/xmut/jwc/bkjw.js new file mode 100644 index 000000000..d1839d9bd --- /dev/null +++ b/lib/v2/xmut/jwc/bkjw.js @@ -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, + }; +}; diff --git a/lib/v2/xmut/jwc/yjs.js b/lib/v2/xmut/jwc/yjs.js new file mode 100644 index 000000000..31dbce149 --- /dev/null +++ b/lib/v2/xmut/jwc/yjs.js @@ -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, + }; +}; diff --git a/lib/v2/xmut/maintainer.js b/lib/v2/xmut/maintainer.js new file mode 100644 index 000000000..4a9a09ccc --- /dev/null +++ b/lib/v2/xmut/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/jwc/:type/:method': ['icecliffs'], +}; diff --git a/lib/v2/xmut/radar.js b/lib/v2/xmut/radar.js new file mode 100644 index 000000000..29a8ecbde --- /dev/null +++ b/lib/v2/xmut/radar.js @@ -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}` : ''}`, + }, + ], + }, +}; \ No newline at end of file diff --git a/lib/v2/xmut/router.js b/lib/v2/xmut/router.js new file mode 100644 index 000000000..30940e31d --- /dev/null +++ b/lib/v2/xmut/router.js @@ -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')); +}; \ No newline at end of file diff --git a/website/docs/routes/university.md b/website/docs/routes/university.md index 556070869..4271c2c0b 100644 --- a/website/docs/routes/university.md +++ b/website/docs/routes/university.md @@ -2507,6 +2507,22 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 厦门理工大学 {#xia-men-li-gong-da-xue} + +### 教务处 {#xia-men-li-gong-da-xue-jiao-wu-chu} + + + +| 本科生教务处 | 系统说明 | 研究生处 | 系统说明 | +| :------: | :--------: | :--------: | :-------: | +| jxyx | 教学运行 | tzgg | 通知公告 | +| zhsw | 综合事务 | xwdt | 新闻动态 | +| xwgl | 学务管理 | xstj | 学术研究 | +| sjjx | 实践教学 | yjsjw | 工作简讯 | +| jyjg | 教研教改 | | | + + + ## 清华大学 {#qing-hua-da-xue} ### 清华大学校内信息发布平台 {#qing-hua-da-xue-qing-hua-da-xue-xiao-nei-xin-xi-fa-bu-ping-tai}