mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
feat: add 国家预警信息发布中心当前生效预警 (#5118)
This commit is contained in:
@@ -32,6 +32,12 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 国家突发事件预警信息发布网
|
||||
|
||||
### 当前生效预警
|
||||
|
||||
<Route author="nczitzk" example="/12379" path="/12379/index"/>
|
||||
|
||||
## 国家应急广播网
|
||||
|
||||
### 预警信息
|
||||
|
||||
@@ -2932,4 +2932,7 @@ router.get('/gelonghui/keyword/:keyword', require('./routes/gelonghui/keyword'))
|
||||
// 光谷社区
|
||||
router.get('/guanggoo/:caty', require('./routes/guanggoo/index'));
|
||||
|
||||
// 国家突发事件预警信息发布网
|
||||
router.get('/12379', require('./routes/12379/index'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `http://www.12379.cn/data/index_map_all.html`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
const data = JSON.parse(response.data.substr('var alertData ='.length, response.data.length + 1));
|
||||
|
||||
const list = data.map((item) => ({
|
||||
title: item.headline,
|
||||
link: `http://www.12379.cn/html/new2018/alarmcontent.shtml?file=${item.identifier}.html}`,
|
||||
description: item.description,
|
||||
pubDate: new Date(item.sendTime).toUTCString(),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `当前生效预警 - 国家突发事件预警信息发布网`,
|
||||
link: currentUrl,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user