diff --git a/lib/v2/whu/hyxt.js b/lib/v2/whu/hyxt.js new file mode 100644 index 000000000..9a13c4c8e --- /dev/null +++ b/lib/v2/whu/hyxt.js @@ -0,0 +1,50 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +const { domain, processMeta, getMeta, processItems } = require('./util'); + +module.exports = async (ctx) => { + const { category = 'tzgg' } = ctx.params; + const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30; + + const rootUrl = `https://hyxt.${domain}`; + const currentUrl = new URL(`${category}.htm`, rootUrl).href; + + const { data: response } = await got(currentUrl); + + const $ = cheerio.load(response); + + let items = $('tr.content-title') + .slice(0, limit) + .toArray() + .map((item) => { + item = $(item); + + const a = item.find('td a'); + + return { + title: a.text(), + link: new URL(a.prop('href'), rootUrl).href, + pubDate: parseDate(item.find('td').last().text()), + }; + }); + + items = await processItems(items, ctx.cache.tryGet, rootUrl); + + const meta = processMeta(response); + const siteName = getMeta(meta, 'SiteName'); + const columnName = getMeta(meta, 'ColumnName'); + + ctx.state.data = { + item: items, + title: `${siteName} - ${columnName}`, + link: currentUrl, + description: getMeta(meta, 'ColumnKeywords'), + language: $('html').prop('lang'), + image: new URL($('div.top-logo img').prop('src'), rootUrl).href, + subtitle: columnName, + author: siteName, + allowEmpty: true, + }; +}; diff --git a/lib/v2/whu/maintainer.js b/lib/v2/whu/maintainer.js index 12acf293a..5748f70c1 100644 --- a/lib/v2/whu/maintainer.js +++ b/lib/v2/whu/maintainer.js @@ -1,5 +1,6 @@ module.exports = { '/cs/:type': ['ttyfly'], '/gs/:type?': ['Delreyaa'], + '/hyxt/:category?': ['nczitzk'], '/news/:category?': ['SChen1024', 'nczitzk'], }; diff --git a/lib/v2/whu/radar.js b/lib/v2/whu/radar.js index be200a32a..079857970 100644 --- a/lib/v2/whu/radar.js +++ b/lib/v2/whu/radar.js @@ -15,6 +15,134 @@ module.exports = { target: '/whu/gs', }, ], + hyxt: [ + { + title: '弘毅学堂 - 新闻动态', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xwdt'], + target: '/whu/hyxt/xwdt', + }, + { + title: '弘毅学堂 - 通知公告', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/tzgg'], + target: '/whu/hyxt/tzgg', + }, + { + title: '弘毅学堂 - 学子风采', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xzfc'], + target: '/whu/hyxt/xzfc', + }, + { + title: '弘毅学堂 - 学术论坛', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xslt'], + target: '/whu/hyxt/xslt', + }, + { + title: '弘毅学堂 - 学堂简报', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xtjb'], + target: '/whu/hyxt/xtjb', + }, + { + title: '弘毅学堂 - 人才培养', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy'], + target: '/whu/hyxt/rcpy', + }, + { + title: '弘毅学堂 - 招生工作', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy/zsgz', '/rcpy'], + target: '/whu/hyxt/rcpy/zsgz', + }, + { + title: '弘毅学堂 - 培养方案', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy/pyfa', '/rcpy'], + target: '/whu/hyxt/rcpy/pyfa', + }, + { + title: '弘毅学堂 - 科研训练', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy/kyxl', '/rcpy'], + target: '/whu/hyxt/rcpy/kyxl', + }, + { + title: '弘毅学堂 - 毕业去向', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy/byqx', '/rcpy'], + target: '/whu/hyxt/rcpy/byqx', + }, + { + title: '弘毅学堂 - 学习资源', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/rcpy/xxzy', '/rcpy'], + target: '/whu/hyxt/rcpy/xxzy', + }, + { + title: '弘毅学堂 - 学生工作', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz'], + target: '/whu/hyxt/xsgz', + }, + { + title: '弘毅学堂 - 党团建设', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz/dtjs', '/xsgz'], + target: '/whu/hyxt/xsgz/dtjs', + }, + { + title: '弘毅学堂 - 学术交流', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz/xsjl', '/xsgz'], + target: '/whu/hyxt/xsgz/xsjl', + }, + { + title: '弘毅学堂 - 书院生活', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz/sysh', '/xsgz'], + target: '/whu/hyxt/xsgz/sysh', + }, + { + title: '弘毅学堂 - 奖助体系', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz/jztx', '/xsgz'], + target: '/whu/hyxt/xsgz/jztx', + }, + { + title: '弘毅学堂 - 事务服务', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xsgz/swfw', '/xsgz'], + target: '/whu/hyxt/xsgz/swfw', + }, + { + title: '弘毅学堂 - 国际合作', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/gjhz'], + target: '/whu/hyxt/gjhz', + }, + { + title: '弘毅学堂 - 国际交流', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/gjhz/gjjl', '/gjhz'], + target: '/whu/hyxt/gjhz/gjjl', + }, + { + title: '弘毅学堂 - 交流分享', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/gjhz/jlfx', '/gjhz'], + target: '/whu/hyxt/gjhz/jlfx', + }, + { + title: '弘毅学堂 - 校友风采', + docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang', + source: ['/xyfc'], + target: '/whu/hyxt/xyfc', + }, + ], news: [ { title: '新闻网 - 武大资讯', diff --git a/lib/v2/whu/router.js b/lib/v2/whu/router.js index d68f93e2c..303cc7cf4 100644 --- a/lib/v2/whu/router.js +++ b/lib/v2/whu/router.js @@ -1,5 +1,6 @@ module.exports = function (router) { router.get('/cs/:type', require('./cs')); router.get('/gs/:type?', require('./gs/index.js')); + router.get('/hyxt/:category*', require('./hyxt')); router.get('/news/:category*', require('./news')); }; diff --git a/website/docs/routes/university.md b/website/docs/routes/university.md index e40a3aed5..b964d7c9e 100644 --- a/website/docs/routes/university.md +++ b/website/docs/routes/university.md @@ -3160,6 +3160,51 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +### 弘毅学堂 {#wu-han-da-xue-hong-yi-xue-tang} + + + +| 新闻动态 | 通知公告 | 学子风采 | 学术论坛 | +| -------- | -------- | -------- | -------- | +| xwdt | tzgg | xzfc | xslt | + +
+ 更多分类 + +#### 学堂简报 {#wu-han-da-xue-hong-yi-xue-tang-xue-tang-jian-bao} + +| 学堂简报 | +| -------- | +| xtjb | + +#### 人才培养 {#wu-han-da-xue-hong-yi-xue-tang-ren-cai-pei-yang} + +| 人才培养 | 招生工作 | 培养方案 | 科研训练 | 毕业去向 | 学习资源 | +| -------- | --------- | --------- | --------- | --------- | --------- | +| rcpy | rcpy/zsgz | rcpy/pyfa | rcpy/kyxl | rcpy/byqx | rcpy/xxzy | + +#### 学生工作 {#wu-han-da-xue-hong-yi-xue-tang-xue-sheng-gong-zuo} + +| 学生工作 | 党团建设 | 学术交流 | 书院生活 | 奖助体系 | 事务服务 | +| -------- | --------- | --------- | --------- | --------- | --------- | +| xsgz | xsgz/dtjs | xsgz/xsjl | xsgz/sysh | xsgz/jztx | xsgz/swfw | + +#### 国际合作 {#wu-han-da-xue-hong-yi-xue-tang-guo-ji-he-zuo} + +| 国际合作 | 国际交流 | 交流分享 | +| -------- | --------- | --------- | +| gjhz | gjhz/gjjl | gjhz/jlfx | + +#### 校友风采 {#wu-han-da-xue-hong-yi-xue-tang-xiao-you-feng-cai} + +| 校友风采 | +| -------- | +| xyfc | + +
+ +
+ ## 武汉纺织大学 {#wu-han-fang-zhi-da-xue} ### 信息门户公告 {#wu-han-fang-zhi-da-xue-xin-xi-men-hu-gong-gao}