feat(route): add 中国科学院软件研究所 (#12719)
* feat(route): add 中国科学院软件研究所 * fix(route): fix Incomplete URL substring sanitization ---------
This commit is contained in:
parent
f6b1d4c49d
commit
5e7c3fcf55
|
|
@ -3713,6 +3713,18 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
<Route author="shengmaosu" example="/cas/ia/yjs" path="/cas/ia/yjs" radar="1"/>
|
||||
|
||||
### 软件研究所
|
||||
|
||||
<Route author="Misaka13514" example="/cas/isxwdt2016/tzgg2016" path="/cas/is/:path+" :paramsDesc="['路径,可在 URL 找到']" radar="1">
|
||||
|
||||
路径参数示例:
|
||||
|
||||
| 通知公告 | 科技动态 | 科普动态 |
|
||||
| ----------------- | ----------------- | ----------------- |
|
||||
| xwdt2016/tzgg2016 | xwdt2016/kjdt2016 | kxcb2016/kpdt2016 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 中国科学院大学
|
||||
|
||||
### 招聘信息
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const baseUrl = 'https://is.cas.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { path } = ctx.params;
|
||||
const response = await got(`${baseUrl}/${path}/`);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const items = $('.list-news ul li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
link: new URL(item.find('a').attr('href'), response.url).href,
|
||||
pubDate: parseDate(item.find('span').text().replace(/\[|\]/g, '')),
|
||||
};
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
if (!item.link.startsWith(`${baseUrl}/`)) {
|
||||
return item;
|
||||
}
|
||||
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
item.description = $('.TRS_Editor').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
link: `${baseUrl}/${path}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -2,6 +2,7 @@ module.exports = {
|
|||
'/cg/:caty?': ['nczitzk'],
|
||||
'/ia/yjs': ['shengmaosu'],
|
||||
'/iee/kydt': ['nczitzk'],
|
||||
'/is/:path+': ['Misaka13514'],
|
||||
'/mesalab/kb': ['renzhexigua'],
|
||||
'/sim/kyjz': ['HenryQW'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,6 +17,18 @@ module.exports = {
|
|||
target: '/cas/ia/yjs',
|
||||
},
|
||||
],
|
||||
'www.is': [
|
||||
{
|
||||
title: '软件研究所',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhong-guo-ke-xue-yuan',
|
||||
source: ['/'],
|
||||
target: (params, url, document) => {
|
||||
if (document.querySelector('.list-news')) {
|
||||
return `/cas/is/${url.split('/').slice(3, -1).join('/')}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
'www.sim': [
|
||||
{
|
||||
title: '上海微系统与信息技术研究所 - 科技进展',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module.exports = (router) => {
|
|||
router.get('/cg/:caty?', require('./cg/index'));
|
||||
router.get('/ia/yjs', require('./ia/yjs'));
|
||||
router.get('/iee/kydt', require('./iee/kydt'));
|
||||
router.get('/is/:path+', require('./is/index'));
|
||||
router.get('/mesalab/kb', require('./mesalab/kb'));
|
||||
router.get('/sim/kyjz', require('./sim/kyjz'));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue