feat: 添加北大生科院近期讲座 (#3685)

This commit is contained in:
TPOB
2020-01-07 14:49:01 +08:00
committed by DIYgod
parent 99552078d1
commit d691931bc1
5 changed files with 39 additions and 4 deletions

View File

@@ -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', '')}`,
},
],
},

View File

@@ -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>

View File

@@ -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" />
## 北京航空航天大学
### 北京航空航天大学

View File

@@ -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'));

View File

@@ -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(),
};
};