mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
@@ -2183,6 +2183,10 @@ category 对应的关键词有
|
||||
|
||||
<route name="东莞市" author="victoriqueko" example="/tingshuitz/dongguan" path="/tingshuitz/dongguan"/>
|
||||
|
||||
<route name="西安市" author="ciaranchen" example="/tingshuitz/xian" path="/tingshuitz/xian"/>
|
||||
|
||||
<route name="阳江市" author="ciaranchen" example="/tingshuitz/yangjiang" path="/tingshuitz/yangjiang"/>
|
||||
|
||||
### 停电通知
|
||||
|
||||
获取未来一天的停电通知
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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(),
|
||||
};
|
||||
};
|
||||
|
||||
31
lib/routes/tingshuitz/xian.js
Normal file
31
lib/routes/tingshuitz/xian.js
Normal file
@@ -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(),
|
||||
};
|
||||
};
|
||||
40
lib/routes/tingshuitz/yangjiang.js
Normal file
40
lib/routes/tingshuitz/yangjiang.js
Normal file
@@ -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(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user