From d691931bc1e8352e2d2d79cee7c60b5ad5091bcb Mon Sep 17 00:00:00 2001 From: TPOB Date: Tue, 7 Jan 2020 14:49:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=8C=97=E5=A4=A7?= =?UTF-8?q?=E7=94=9F=E7=A7=91=E9=99=A2=E8=BF=91=E6=9C=9F=E8=AE=B2=E5=BA=A7?= =?UTF-8?q?=20(#3685)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/radar-rules.js | 2 +- docs/new-media.md | 6 ++--- docs/university.md | 4 +++ lib/router.js | 1 + lib/routes/universities/pku/cls/lecture.js | 30 ++++++++++++++++++++++ 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 lib/routes/universities/pku/cls/lecture.js diff --git a/assets/radar-rules.js b/assets/radar-rules.js index fc4821c19..69fb36c02 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -759,7 +759,7 @@ title: '分类', docs: 'https://docs.rsshub.app/new-media.html#hao-qi-xin-ri-bao', source: '/categories/:idd', - target: (params) => `/qdaily/researcach/${params.idd.replace('.html', '')}`, + target: (params) => `/qdaily/category/${params.idd.replace('.html', '')}`, }, ], }, diff --git a/docs/new-media.md b/docs/new-media.md index f2ca47b26..54e9904a8 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -411,9 +411,9 @@ Supported sub-sites: -| 标签 | 栏目 | 分类 | -| ---- | ------ | ---------- | -| tag | column | researcach | +| 标签 | 栏目 | 分类 | +| ---- | ------ | -------- | +| tag | column | category | diff --git a/docs/university.md b/docs/university.md index 3141d7cae..dd754028c 100644 --- a/docs/university.md +++ b/docs/university.md @@ -54,6 +54,10 @@ pageClass: routes +### 生命科学学院近期讲座 + + + ## 北京航空航天大学 ### 北京航空航天大学 diff --git a/lib/router.js b/lib/router.js index 08277016f..d740648ad 100644 --- a/lib/router.js +++ b/lib/router.js @@ -581,6 +581,7 @@ router.get('/lit/tw/:name?', require('./routes/universities/lit/tw')); // 北京大学 router.get('/pku/eecs/:type?', require('./routes/universities/pku/eecs')); router.get('/pku/rccp/mzyt', require('./routes/universities/pku/rccp/mzyt')); +router.get('/pku/cls/lecture', require('./routes/universities/pku/cls/lecture')); // 上海海事大学 router.get('/shmtu/www/:type', require('./routes/universities/shmtu/www')); diff --git a/lib/routes/universities/pku/cls/lecture.js b/lib/routes/universities/pku/cls/lecture.js new file mode 100644 index 000000000..7cad270e5 --- /dev/null +++ b/lib/routes/universities/pku/cls/lecture.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +const homeUrl = 'http://www.bio.pku.edu.cn/homes/Index/news_jz/7/7.html'; +const baseUrl = 'http://www.bio.pku.edu.cn'; + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: homeUrl, + }); + + const $ = cheerio.load(response.data); + ctx.state.data = { + title: `北京大学生命科学学院近期讲座`, + link: homeUrl, + description: `北京大学生命科学学院近期讲座`, + item: $('a.clearfix') + .map((index, item) => ({ + title: $(item) + .find('p') + .text() + .trim(), + description: '日期: ' + $(item).find('span'), // ${item.find('.chair_txt div').find('span').second().text()} + + link: baseUrl + $('a.clearfix').attr('href'), + })) + .get(), + }; +};