Skip to content

Commit

Permalink
feat: 添加北大生科院近期讲座 (DIYgod#3685)
Browse files Browse the repository at this point in the history
  • Loading branch information
TTTPOB authored and DIYgod committed Jan 7, 2020
1 parent 9955207 commit d691931
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/radar-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '')}`,
},
],
},
Expand Down
6 changes: 3 additions & 3 deletions docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ Supported sub-sites:

<Route author="WenhuWee emdoe SivaGao HenryQW" example="/qdaily/column/59" path="/qdaily/:type/:id" :paramsDesc="['类型,见下表', '对应 id,可在 URL 找到']" radar="1">

| 标签 | 栏目 | 分类 |
| ---- | ------ | ---------- |
| tag | column | researcach |
| 标签 | 栏目 | 分类 |
| ---- | ------ | -------- |
| tag | column | category |

</Route>

Expand Down
4 changes: 4 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ pageClass: routes

<Route author="AngUOI" example="/pku/rccp/mzyt" path="/universities/pku/rccp/mzyt" />

### 生命科学学院近期讲座

<Route author="TPOB" example="/pku/cls/lecture" path="/universities/pku/cls/lecture" />

## 北京航空航天大学

### 北京航空航天大学
Expand Down
1 change: 1 addition & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
30 changes: 30 additions & 0 deletions lib/routes/universities/pku/cls/lecture.js
Original file line number Diff line number Diff line change
@@ -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(),
};
};

0 comments on commit d691931

Please sign in to comment.