diff --git a/lib/v2/sqmc/maintainer.js b/lib/v2/sqmc/maintainer.js new file mode 100644 index 000000000..19cd9e5c8 --- /dev/null +++ b/lib/v2/sqmc/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/www/:category?': ['nyaShine'], +}; diff --git a/lib/v2/sqmc/radar.js b/lib/v2/sqmc/radar.js new file mode 100644 index 000000000..0b10ff0c4 --- /dev/null +++ b/lib/v2/sqmc/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'sqmc.edu.cn': { + _name: '新乡医学院三全学院', + '.': [ + { + title: '官网信息', + docs: 'https://docs.rsshub.app/university.html#xin-xiang-yi-xue-yuan-san-quan-xue-yuan', + source: ['/:category/list.htm'], + target: '/sqmc/www/:category?', + }, + ], + }, +}; diff --git a/lib/v2/sqmc/router.js b/lib/v2/sqmc/router.js new file mode 100644 index 000000000..d4a87dd6d --- /dev/null +++ b/lib/v2/sqmc/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/www/:category?', require('./www')); +}; diff --git a/lib/v2/sqmc/www.js b/lib/v2/sqmc/www.js new file mode 100644 index 000000000..3686eb446 --- /dev/null +++ b/lib/v2/sqmc/www.js @@ -0,0 +1,49 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const category = ctx.params.category || '3157'; + + const rootUrl = 'https://www.sqmc.edu.cn'; + const currentUrl = `${rootUrl}/${category}/list.htm`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + const list = $('div#wp_news_w9 ul li').get(); + + ctx.state.data = { + title: `新乡医学院三全学院官网信息${$('title').text()}`, + link: currentUrl, + item: await Promise.all( + list.map(async (item) => { + item = $(item); + + const link = new URL(item.find('dt a').attr('href'), rootUrl).href; + const pubDate = parseDate(item.find('dd').eq(0).text(), 'YYYY-MM-DD'); + + const cache = await ctx.cache.tryGet(link, async () => { + const detailResponse = await got({ + method: 'get', + url: link, + }); + const content = cheerio.load(detailResponse.data); + + return { + title: item.find('dt a').text(), + description: content('div.Tr_Detail').html(), + link, + pubDate: timezone(pubDate, +8), + }; + }); + + return cache; + }) + ), + }; +}; diff --git a/website/docs/routes/university.md b/website/docs/routes/university.md index bebec186e..556070869 100644 --- a/website/docs/routes/university.md +++ b/website/docs/routes/university.md @@ -3434,6 +3434,18 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 新乡医学院三全学院 {#xin-xiang-yi-xue-yuan-san-quan-xue-yuan} + +### 官网信息 {#xin-xiang-yi-xue-yuan-san-quan-xue-yuan-guan-wang-xin-xi} + + + +| 学校要闻 | 通知 | 学术讲座 | 基层风采书院 | 基层风采院系 | 外媒报道 | 三全学院报 | +| -------- | -------- | -------- | -------- | -------- | -------- | -------- | +| 3157 | 3187 | 3188 | 3185 | 3186 | 3199 | 3200 | + + + ## 信阳师范学院 {#xin-yang-shi-fan-xue-yuan} ### 高等教育自学考试办公室 {#xin-yang-shi-fan-xue-yuan-gao-deng-jiao-yu-zi-xue-kao-shi-ban-gong-shi}