feat: add 中国信通院研究成果 (#4895)
This commit is contained in:
parent
a681506b84
commit
e0b854715d
|
|
@ -99,6 +99,20 @@ pageClass: routes
|
|||
|
||||
<Route author="Yoge-Code" example="/gov/cnca/zxtz" path="/gov/cnca/zxtz"/>
|
||||
|
||||
## 中国信息通信研究院
|
||||
|
||||
### 白皮书
|
||||
|
||||
<Route author="nczitzk" example="/gov/caict/bps" path="/gov/caict/bps"/>
|
||||
|
||||
### 权威数据
|
||||
|
||||
<Route author="nczitzk" example="/gov/caict/qwsj" path="/gov/caict/qwsj"/>
|
||||
|
||||
### CAICT 观点
|
||||
|
||||
<Route author="nczitzk" example="/gov/caict/caictgd" path="/gov/caict/caictgd"/>
|
||||
|
||||
## 中国政府
|
||||
|
||||
### 最新政策
|
||||
|
|
|
|||
|
|
@ -2801,4 +2801,9 @@ router.get('/samsungmembers/latest', require('./routes/samsungmembers/latest'));
|
|||
// 东莞教研网
|
||||
router.get('/dgjyw/:type', require('./routes/dgjyw/index'));
|
||||
|
||||
// 中国信息通信研究院
|
||||
router.get('/gov/caict/bps', require('./routes/gov/caict/bps'));
|
||||
router.get('/gov/caict/qwsj', require('./routes/gov/caict/qwsj'));
|
||||
router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.caict.ac.cn/kxyj/qwfb/bps/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('td[width="540"]')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(link, a.attr('href')),
|
||||
pubDate: item.next().find('span.kxyj_text').text(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(res.data);
|
||||
item.description = content('div.pagemain').parent().parent().parent().html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国信息通信研究院 - 白皮书',
|
||||
link: link,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.caict.ac.cn/kxyj/caictgd/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('td[width="600"]')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(link, a.attr('href')),
|
||||
pubDate: item.next().find('span.kxyj_text').text(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(res.data);
|
||||
item.description = content('div.pagemaintext').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国信息通信研究院 - CAICT观点',
|
||||
link: link,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.caict.ac.cn/kxyj/qwfb/qwsj/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('td[width="540"]')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(link, a.attr('href')),
|
||||
pubDate: item.next().find('span.kxyj_text').text(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国信息通信研究院 - 权威数据',
|
||||
link: link,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue