diff --git a/docs/README.md b/docs/README.md
index e6096fad1d..d53b964e30 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2183,6 +2183,10 @@ category 对应的关键词有
+
+
+
+
### 停电通知
获取未来一天的停电通知
diff --git a/lib/router.js b/lib/router.js
index 45e92a49cc..e2c0304f7f 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -373,6 +373,8 @@ router.get('/tingshuitz/xiaoshan', require('./routes/tingshuitz/xiaoshan'));
router.get('/tingshuitz/dalian', require('./routes/tingshuitz/dalian'));
router.get('/tingshuitz/guangzhou', require('./routes/tingshuitz/guangzhou'));
router.get('/tingshuitz/dongguan', require('./routes/tingshuitz/dongguan'));
+router.get('/tingshuitz/xian', require('./routes/tingshuitz/xian'));
+router.get('/tingshuitz/yangjiang', require('./routes/tingshuitz/yangjiang'));
// MIUI 更新
router.get('/miui/:device/:type?/:region?', require('./routes/miui/index'));
diff --git a/lib/routes/tingshuitz/guangzhou.js b/lib/routes/tingshuitz/guangzhou.js
index e9440bcffa..8b4b94b375 100644
--- a/lib/routes/tingshuitz/guangzhou.js
+++ b/lib/routes/tingshuitz/guangzhou.js
@@ -3,7 +3,7 @@ const cheerio = require('cheerio');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
- const url = 'http://www.gzwatersupply.com/stop/stopgl.html2?tab=9';
+ const url = 'http://www.gzwatersupply.com/stop/stopgl.html2';
const response = await axios({
responseType: 'arraybuffer',
method: 'get',
@@ -12,26 +12,24 @@ module.exports = async (ctx) => {
const data = response.data;
const $ = cheerio.load(iconv.decode(data, 'gb2312'));
- const list = $('table')
- .eq(37)
- .find('tr');
+ const list = $(
+ 'body > table:nth-child(2) > tbody:nth-child(2) > tr > td.border3 > table:nth-child(2) > tbody > tr:nth-child(1) > td:nth-child(2) > table > tbody > tr:nth-child(3) > td > table > tbody > tr > td > table > tbody > tr:nth-child(3) > td > table > tbody > tr'
+ );
ctx.state.data = {
title: '停水通知 - 广州市自来水公司',
- link: 'http://www.gzwatersupply.com/stop/stopgl.html2?tab=9',
- item:
- list &&
- list
- .map((index, item) => {
- item = $(item);
+ link: 'http://www.gzwatersupply.com/stop/stopgl.html2',
+ item: list
+ .map((index, item) => {
+ item = $(item);
- const title = item.text();
- return {
- title,
- description: `广州市停水通知:${title}`,
- link: `http://www.gzwatersupply.com/stop/${item.find('.new2').attr('href')}`,
- };
- })
- .get(),
+ const title = item.text();
+ return {
+ title,
+ description: `广州市停水通知:${title}`,
+ link: `http://www.gzwatersupply.com/stop/${item.find('.new2').attr('href')}`,
+ };
+ })
+ .get(),
};
};
diff --git a/lib/routes/tingshuitz/xian.js b/lib/routes/tingshuitz/xian.js
new file mode 100644
index 0000000000..9caddd69e3
--- /dev/null
+++ b/lib/routes/tingshuitz/xian.js
@@ -0,0 +1,31 @@
+const axios = require('../../utils/axios');
+const cheerio = require('cheerio');
+const iconv = require('iconv-lite');
+
+module.exports = async (ctx) => {
+ const url = 'http://www.xazls.com/tsgg/index.htm';
+ const response = await axios.get(url, {
+ responseType: 'arraybuffer',
+ });
+
+ const data = response.data;
+ const $ = cheerio.load(iconv.decode(data, 'gb2312'));
+ const list = $('#body > div.M > div.AboutUsDetail > ul > li');
+
+ ctx.state.data = {
+ title: $('title').text() || '停水通知 - 西安市自来水有限公司',
+ link: 'http://www.xazls.com/tsgg/index.htm',
+ item: list
+ .map((_, el) => {
+ const item = $(el);
+
+ const a = item.find('a');
+ return {
+ title: a.text().trim(),
+ description: item.text().trim(),
+ link: 'http://www.xazls.com' + a.attr('href'),
+ };
+ })
+ .get(),
+ };
+};
diff --git a/lib/routes/tingshuitz/yangjiang.js b/lib/routes/tingshuitz/yangjiang.js
new file mode 100644
index 0000000000..fbbdeea5a5
--- /dev/null
+++ b/lib/routes/tingshuitz/yangjiang.js
@@ -0,0 +1,40 @@
+const axios = require('../../utils/axios');
+const cheerio = require('cheerio');
+const iconv = require('iconv-lite');
+
+module.exports = async (ctx) => {
+ const url = 'http://www.yjsswjt.com/zxdt_list.jsp?flbz=7';
+ const response = await axios.get(url, {
+ responseType: 'arraybuffer',
+ });
+
+ const data = response.data;
+ const $ = cheerio.load(iconv.decode(data, 'gb2312'));
+ const list = $('div.list_ul_div > ul > li');
+
+ ctx.state.data = {
+ title: '停水通知 - 阳江市水务集团有限公司',
+ link: 'http://www.yjsswjt.com/zxdt_list.jsp?flbz=7',
+ item: list
+ .map((_, el) => {
+ const item = $(el);
+
+ const id = item
+ .find('a')
+ .attr('href')
+ .slice(17, -1);
+ return {
+ title: item
+ .find('span')
+ .text()
+ .trim(),
+ description: item
+ .find('span')
+ .text()
+ .trim(),
+ link: 'http://www.yjsswjt.com/list.jsp?id=' + id,
+ };
+ })
+ .get(),
+ };
+};