diff --git a/docs/study.md b/docs/study.md index 33f6bb8ec7..31e8dce8fc 100644 --- a/docs/study.md +++ b/docs/study.md @@ -61,12 +61,12 @@ path="/ctfhub/search/:limit?/:form?/:class?/:title?" | `:class` | 类型 | | :------: | --------------------------------- | -| 0 | Jeopardy [解题] | -| 1 | Attack with Defense [AwD 攻防] | -| 2 | Robo Hacking Game [RHG AI 自动化] | -| 3 | Real World [RW 真实世界] | -| 4 | King of The Hill [KoH 抢占山头] | -| 5 | Mix [混合] | +| 0 | Jeopardy [解题] | +| 1 | Attack with Defense [AwD 攻防] | +| 2 | Robo Hacking Game [RHG AI 自动化] | +| 3 | Real World [RW 真实世界] | +| 4 | King of The Hill [KoH 抢占山头] | +| 5 | Mix [混合] | > class 以 的返回结果为准 @@ -128,8 +128,8 @@ path="/ctfhub/upcoming/:limit?" -| in | online | cleaning | buy | best | services | for | carpet | service | india | company | and | de | mapa | control | malware | online-dating-website-reviews | virus | international-online-dating-sites-review | repair | -| -- | ------ | -------- | --- | ---- | -------- | --- | ------ | ------- | ----- | ------- | --- | -- | ---- | ------- | ------- | ----------------------------- | ----- | ---------------------------------------- | ------ | +| in | online | cleaning | buy | best | services | for | carpet | service | india | company | and | de | mapa | control | malware | online-dating-website-reviews | virus | international-online-dating-sites-review | repair | +| --- | ------ | -------- | --- | ---- | -------- | --- | ------ | ------- | ----- | ------- | --- | --- | ---- | ------- | ------- | ----------------------------- | ----- | ---------------------------------------- | ------ | @@ -274,9 +274,9 @@ path="/ctfhub/upcoming/:limit?" -| 新闻中心 | 公务员考试 | 事业单位 | (职)业资格、职称考试 | 其他 | +| 新闻中心 | 公务员考试 | 事业单位 | (职)业资格、职称考试 | 其他 | | :------: | :--------: | :------: | :--------------------: | :---: | -| all | gwy | sydw | zyzc | other | +| all | gwy | sydw | zyzc | other | @@ -699,13 +699,27 @@ path="/ctfhub/upcoming/:limit?" ## 中国研究生招生信息网 +### 考研热点新闻 + + + ### 考研动态 -### 考研热点新闻 +### 考研资讯 - + + +| `:type` | 专题名称 | +| ------- | -------- | +| fstj | 复试调剂 | +| kydt | 考研动态 | +| zcdh | 政策导航 | +| kyrw | 考研人物 | +| jyxd | 经验心得 | + + ## 中国智库网 diff --git a/lib/v2/chsi/kyzx.js b/lib/v2/chsi/kyzx.js new file mode 100644 index 0000000000..28440adc60 --- /dev/null +++ b/lib/v2/chsi/kyzx.js @@ -0,0 +1,51 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +const host = 'https://yz.chsi.com.cn'; + +module.exports = async (ctx) => { + const { type } = ctx.request.params; + const response = await got(`${host}/kyzx/${type}`); + const $ = cheerio.load(response.data); + const typeName = $('.bread-nav .location a').last().text() || '考研资讯'; + const list = $('ul.news-list').children(); + const items = await Promise.all( + list.map((i, item) => { + item = $(item); + const itemTitle = item.find('a').text(); + const itemDate = item.find('.span-time').text(); + const path = item.find('a').attr('href'); + let itemUrl = ''; + if (path.startsWith('http')) { + itemUrl = path; + } else { + itemUrl = host + path; + } + return ctx.cache.tryGet(itemUrl, async () => { + let description = ''; + if (itemUrl) { + const result = await got(itemUrl); + const $ = cheerio.load(result.data); + description = $('#article_dnull').html().trim(); + } else { + description = itemTitle; + } + return { + title: itemTitle, + link: itemUrl, + pubDate: timezone(parseDate(itemDate), 8), + description, + }; + }); + }) + ); + + ctx.state.data = { + title: `中国研究生招生信息网 - ${typeName}`, + link: `${host}/kyzx/${type}/`, + description: `中国研究生招生信息网 - ${typeName}`, + item: items, + }; +}; diff --git a/lib/v2/chsi/maintainer.js b/lib/v2/chsi/maintainer.js index f1c5a83e9e..fe3cfcf202 100644 --- a/lib/v2/chsi/maintainer.js +++ b/lib/v2/chsi/maintainer.js @@ -1,4 +1,5 @@ module.exports = { '/hotnews': ['yanbot-team'], '/kydt': ['SunBK201'], + '/kyzx/:type': ['yanbot-team'], }; diff --git a/lib/v2/chsi/radar.js b/lib/v2/chsi/radar.js index 635b6998a2..d2683e6798 100644 --- a/lib/v2/chsi/radar.js +++ b/lib/v2/chsi/radar.js @@ -2,6 +2,12 @@ module.exports = { 'chsi.com.cn': { _name: '中国研究生招生信息网', yz: [ + { + title: '考研热点新闻', + docs: 'https://docs.rsshub.app/study.html#zhong-guo-yan-jiu-sheng-zhao-sheng-xin-xi-wang', + source: ['/'], + target: '/chsi/hotnews', + }, { title: '考研动态', docs: 'https://docs.rsshub.app/study.html#zhong-guo-yan-jiu-sheng-zhao-sheng-xin-xi-wang', @@ -9,10 +15,10 @@ module.exports = { target: '/chsi/kydt', }, { - title: '考研热点新闻', + title: '考研资讯', docs: 'https://docs.rsshub.app/study.html#zhong-guo-yan-jiu-sheng-zhao-sheng-xin-xi-wang', - source: ['/'], - target: '/chsi/hotnews', + source: ['/kyzx/:type'], + target: '/chsi/kyzx/:type', }, ], }, diff --git a/lib/v2/chsi/router.js b/lib/v2/chsi/router.js index b80d289fa9..c50ed6c074 100644 --- a/lib/v2/chsi/router.js +++ b/lib/v2/chsi/router.js @@ -1,4 +1,5 @@ module.exports = (router) => { router.get('/hotnews', require('./hotnews')); router.get('/kydt', require('./kydt')); + router.get('/kyzx/:type', require('./kyzx')); };