feat: add 中国工程科技知识中心知识应用 (#5802)
Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
@@ -829,3 +829,22 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
### はてな匿名ダイアリー - 人気記事アーカイブ
|
||||
|
||||
<Route author="masakichi" example="/hatena/anonymous_diary/archive" path="/hatena/anonymous_diary/archive"/>
|
||||
|
||||
## 中国工程科技知识中心
|
||||
|
||||
### 知识应用
|
||||
|
||||
<Route author="nczitzk" example="/cktest/app" path="/cktest/app/:ctgroup?/:domain?" :paramsDesc="['所属类别,见下表,默认为全部类别', '领域,见下表,默认为全部列表']">
|
||||
|
||||
所属类别
|
||||
|
||||
| 专题知识服务 | 知识分析 | 知识工具 | 综合性知识服务 | 全部类别 |
|
||||
| ------------ | -------- | -------- | -------------- | -------- |
|
||||
| 2 | 3 | 4 | 1 | 0 |
|
||||
|
||||
领域
|
||||
|
||||
| 综合 | 农业 | 航天 | 地质 | 信息技术 | 林业 | 医药卫生 | 战略性新兴产业 | 能源 | 冶金 | 化工 | 地理信息 | 营养健康 | 工程科教图书 | 交通 | 创新设计 | 地理资源与生态 | 材料 | 气象 | 渔业 | 环境工程 | 试验技术 | 中草药 | 水利 | 海洋工程 |
|
||||
| ---- | ---- | ---- | ---- | -------- | ---- | -------- | -------------- | ---- | ---- | ---- | -------- | -------- | ------------ | ---- | -------- | -------------- | ---- | ---- | ---- | -------- | -------- | ------ | ---- | -------- |
|
||||
|
||||
</Route>
|
||||
|
||||
@@ -3257,6 +3257,8 @@ router.get('/appsales/:caty?/:time?', require('./routes/appsales/index'));
|
||||
// CGTN
|
||||
router.get('/cgtn/top', require('./routes/cgtn/top'));
|
||||
|
||||
// 中国工程科技知识中心
|
||||
router.get('/cktest/app/:ctgroup?/:domain?', require('./routes/cktest/app'));
|
||||
// 妈咪帮
|
||||
router.get('/mamibuy/:caty?/:age?/:sort?', require('./routes/mamibuy/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const ctgroup = ctx.params.ctgroup ? (ctx.params.ctgroup === '0' ? '' : 'CTGRGUP==' + ctx.params.ctgroup) : '';
|
||||
const domain = ctx.params.domain ? 'DOMAIN==' + ctx.params.domain : '';
|
||||
|
||||
const rootUrl = `http://www.ckcest.cn/home/app/list?category=${ctgroup}${ctgroup && domain ? ' AND ' : ''}${domain}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const items = $('.search-result-list')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('h4.sc-title a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: a.attr('href'),
|
||||
description: item.find('.applySummary-new').text(),
|
||||
author: item.find('.applyInfor-new span').eq(1).text(),
|
||||
pubDate: new Date(item.find('.applyInfor-new span').eq(0).text() + ' GMT+8').toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '知识应用 - 中国工程科技知识中心',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user