添加 停水通知 (#315)
* Add tingshuitz in Hanghou, Xiaoshan, Dalian area * 更新 停水通知 文档 * 更正文档链接错误处 * Remove package-lock.json * Change .gitignore
This commit is contained in:
parent
c0444c885b
commit
3d63c2f7d5
|
|
@ -2,6 +2,7 @@ node_modules
|
|||
npm-debug.log
|
||||
error.log
|
||||
combined.log
|
||||
package-lock.json
|
||||
.vscode
|
||||
docs/.vuepress/dist
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,10 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 教务信息
|
||||
- 新京报
|
||||
- 快讯
|
||||
- 停水通知
|
||||
- 杭州市
|
||||
- 萧山区
|
||||
- 大连市
|
||||
|
||||
## 鸣谢
|
||||
|
||||
|
|
|
|||
|
|
@ -1271,3 +1271,31 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
|||
路由: `/bjnews/:category`
|
||||
|
||||
参数: category,新京报的栏目名,点击对应栏目后在地址栏找到
|
||||
|
||||
## 停水通知
|
||||
|
||||
配合 [IFTTT](https://ifttt.com/) Applets [邮件通知](https://ifttt.com/applets/SEvmDVKY-) 使用实现自动通知效果
|
||||
|
||||
### 杭州市
|
||||
|
||||
举例: [https://rsshub.app/tingshuitz/hangzhou](https://rsshub.app/tingshuitz/hangzhou)
|
||||
|
||||
路由: `/tingshuitz/hangzhou`
|
||||
|
||||
参数: 无
|
||||
|
||||
### 萧山区
|
||||
|
||||
举例: [https://rsshub.app/tingshuitz/xiaoshan](https://rsshub.app/tingshuitz/xiaoshan)
|
||||
|
||||
路由: `/tingshuitz/xiaoshan`
|
||||
|
||||
参数: 无
|
||||
|
||||
### 大连市
|
||||
|
||||
举例: [https://rsshub.app/tingshuitz/dalian](https://rsshub.app/tingshuitz/dalian)
|
||||
|
||||
路由: `/tingshuitz/dalian`
|
||||
|
||||
参数: 无
|
||||
|
|
|
|||
|
|
@ -309,4 +309,9 @@ router.get('/shmtu/jwc/:type', require('./routes/shmtu/jwc'));
|
|||
// 新京报
|
||||
router.get('/bjnews/:cat', require('./routes/bjnews/news'));
|
||||
|
||||
// 停水通知
|
||||
router.get('/tingshuitz/hangzhou', require('./routes/tingshuitz/hangzhou'));
|
||||
router.get('/tingshuitz/xiaoshan', require('./routes/tingshuitz/xiaoshan'));
|
||||
router.get('/tingshuitz/dalian', require('./routes/tingshuitz/dalian'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
//const area = ctx.params.area;
|
||||
const url = `http://www.swj.dl.gov.cn/html/tstz/`;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.listBox li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text() || '停水通知 - 大连市水务局',
|
||||
link: `http://www.swj.dl.gov.cn/html/tstz/`,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text() || '停水通知 - 大连市水务局',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
description: `大连市停水通知:${item.find('a').text()}`,
|
||||
pubDate: new Date(item.find('span').text()).toUTCString(),
|
||||
link: `${item.find('a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
//const area = ctx.params.area;
|
||||
const url = `http://www.hzwgc.com/public/stop_the_water/`;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.datalist li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: `http://www.hzwgc.com/public/stop_the_water/`,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.title').text(),
|
||||
description: `杭州市停水通知:${item.find('.title').text()}`,
|
||||
pubDate: new Date(item.find('.published').text()).toUTCString(),
|
||||
link: `http://www.hzwgc.com${item.find('.btn-read').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
//const area = ctx.params.area;
|
||||
const url = 'http://www.xswater.com/gongshui/channels/227.html';
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.ul-list li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: `http://www.xswater.com/gongshui/channels/227.html`,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
description: `萧山区停水通知:${item.find('a').text()}`,
|
||||
pubDate: new Date(
|
||||
item
|
||||
.find('span')
|
||||
.text()
|
||||
.slice(1, 11)
|
||||
).toUTCString(),
|
||||
link: `http://www.xswater.com${item.find('a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue