diff --git a/docs/study.md b/docs/study.md index 042669c95b..f62eb0ca4d 100644 --- a/docs/study.md +++ b/docs/study.md @@ -388,6 +388,18 @@ pageClass: routes +## 阳光高考 + +### 教育部阳光高考信息公开平台招生政策规定 + + + +| 招生政策 | 深化考试招生制度改革 | 教育法律法规 | +| -------- | -------------------- | ------------ | +| dnzszc | zdgg | jyflfg | + + + ## 印象识堂 ### 印象剪藏 diff --git a/lib/router.js b/lib/router.js index d8d1253aa9..be075f911a 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3789,6 +3789,9 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog')); // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); +// 阳光高考 +router.get('/chsi/zszcgd/:category?', require('./routes/chsi/zszcgd')); + // 眾新聞 router.get('/hkcnews/news/:category?', require('./routes/hkcnews/news')); @@ -3829,4 +3832,5 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index // booth.pm router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop')); + module.exports = router; diff --git a/lib/routes/chsi/zszcgd.js b/lib/routes/chsi/zszcgd.js new file mode 100644 index 0000000000..911a5f6f3f --- /dev/null +++ b/lib/routes/chsi/zszcgd.js @@ -0,0 +1,52 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category || 'dnzszc'; + + const rootUrl = 'https://gaokao.chsi.com.cn'; + const currentUrl = `${rootUrl}/gkxx/zszcgd/${category}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.list ul li a') + .slice(0, 15) + .map((_, item) => { + item = $(item); + const link = item.attr('href'); + + return { + title: item.text(), + pubDate: new Date(item.prev().text()).toUTCString(), + link: link.indexOf('http') < 0 ? `${rootUrl}${link}` : link, + }; + }) + .get(); + + const items = await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + item.description = content('.list').html(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: `${$('.backb').text()} - 教育部阳光高考信息公开平台`, + link: currentUrl, + item: items, + }; +};