mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 02:08:55 +08:00
feat: add 中国科学院电工研究所科研动态 (#5801)
Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
@@ -1942,6 +1942,10 @@ type 列表:
|
||||
|
||||
<Route author="renzhexigua" example="/cas/mesalab/kb" path="/cas/mesalab/kb"/>
|
||||
|
||||
### 中国科学院电工研究所 科研动态
|
||||
|
||||
<Route author="nczitzk" example="/cas/iee/kydt" path="/cas/iee/kydt"/>
|
||||
|
||||
## 中国农业大学
|
||||
|
||||
### 中国农业大学研招网通知公告
|
||||
|
||||
@@ -666,6 +666,7 @@ router.get('/gdut/news', require('./routes/universities/gdut/news'));
|
||||
// 中国科学院
|
||||
router.get('/cas/sim/academic', require('./routes/universities/cas/sim/academic'));
|
||||
router.get('/cas/mesalab/kb', require('./routes/universities/cas/mesalab/kb'));
|
||||
router.get('/cas/iee/kydt', require('./routes/universities/cas/iee/kydt'));
|
||||
router.get('/cas/cg/:caty?', require('./routes/universities/cas/cg/index'));
|
||||
|
||||
// 中国传媒大学
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.iee.cas.cn/xwzx/kydt';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('li.entry .entry-content-title')
|
||||
.slice(0, 15)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: a.attr('href'),
|
||||
};
|
||||
})
|
||||
.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('.article-content').html();
|
||||
item.pubDate = new Date(content('time').text().split(':')[1] + ' GMT+8').toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '科研成果 - 中国科学院电工研究所',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user