mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
feat: 添加国家卫健委疫情通报 (#3826)
This commit is contained in:
@@ -390,6 +390,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
## 武汉肺炎疫情新闻动态
|
||||
|
||||
### 国家卫健委 - 疫情通报
|
||||
|
||||
<Route author="Cielpy" example="/nhc/list_gzbd" path="/nhc/list_gzbd"/>
|
||||
|
||||
### 财新网 - 武汉肺炎防疫全纪录
|
||||
|
||||
<Route author="DIYgod" example="/coronavirus/caixin" path="/coronavirus/caixin"/>
|
||||
|
||||
@@ -2159,5 +2159,6 @@ router.get('/coronavirus/dxy/data/:province', require('./routes/coronavirus/dxy-
|
||||
router.get('/coronavirus/dxy/data', require('./routes/coronavirus/dxy-data-country'));
|
||||
router.get('/coronavirus/dxy', require('./routes/coronavirus/dxy'));
|
||||
router.get('/coronavirus/scmp', require('./routes/coronavirus/scmp'));
|
||||
router.get('/nhc/list_gzbd', require('./routes/nhc/list_gzbd'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
35
lib/routes/nhc/list_gzbd.js
Normal file
35
lib/routes/nhc/list_gzbd.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('.zxxx_list a').get();
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const title = $(item).text();
|
||||
const address = $(item).attr('href');
|
||||
const cache = await ctx.cache.get(address);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
const host = `http://www.nhc.gov.cn/`;
|
||||
const single = {
|
||||
title,
|
||||
description: title,
|
||||
link: host + address,
|
||||
guid: host + address,
|
||||
};
|
||||
ctx.cache.set(address, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '疫情通报',
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user