mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 中国工程科技知识中心产业政策 (#5864)
This commit is contained in:
@@ -825,6 +825,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
</Route>
|
||||
|
||||
### 产业政策
|
||||
|
||||
<Route author="nczitzk" example="/cktest/policy" path="/cktest/policy"/>
|
||||
|
||||
## 中国银行
|
||||
|
||||
### 中国银行外汇牌价
|
||||
|
||||
@@ -3292,6 +3292,7 @@ router.get('/95mm/category/:category', require('./routes/95mm/category'));
|
||||
|
||||
// 中国工程科技知识中心
|
||||
router.get('/cktest/app/:ctgroup?/:domain?', require('./routes/cktest/app'));
|
||||
router.get('/cktest/policy', require('./routes/cktest/policy'));
|
||||
|
||||
// 妈咪帮
|
||||
router.get('/mamibuy/:caty?/:age?/:sort?', require('./routes/mamibuy/index'));
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = '1005';
|
||||
|
||||
const rootUrl = `http://mall.ckcest.cn/mall/listContent.ilf?dbId=${id}&text=&express=&secondSearchExpress=&order=3&page=1&limit=10`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const list = response.data.results.datas.map((item) => ({
|
||||
link: item.detail_url,
|
||||
}));
|
||||
|
||||
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);
|
||||
|
||||
const dateArray = content('meta[name="firstpublishedtime"]').attr('content').split('-');
|
||||
const time = dateArray.pop();
|
||||
|
||||
item.pubDate = `${dateArray.join('-')} ${time}`;
|
||||
item.title = content('title').text().split('_')[0];
|
||||
item.description = content('.wrap').html() || content('.policyLibraryOverview_content').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '产业政策 - 中国工程科技知识中心',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user