增加:停水通知-广州市 (#904)
This commit is contained in:
parent
6dee8af709
commit
143862e8bf
|
|
@ -1427,6 +1427,8 @@ Category 列表:
|
|||
|
||||
<route name="大连市" author="DIYgod" example="/tingshuitz/dalian" path="/tingshuitz/dalian"/>
|
||||
|
||||
<route name="广州市" author="xyqfer" example="/tingshuitz/guangzhou" path="/tingshuitz/guangzhou"/>
|
||||
|
||||
### 中央气象台
|
||||
|
||||
<route name="全国气象预警" author="ylc395" example="/weatheralarm" path="/weatheralarm">
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ 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'));
|
||||
router.get('/tingshuitz/guangzhou', require('./routes/tingshuitz/guangzhou'));
|
||||
|
||||
// MIUI 更新
|
||||
router.get('/miui/:device/:type?', require('./routes/miui/index'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
const axios = require('../../utils/axios');
|
||||
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 response = await axios({
|
||||
responseType: 'arraybuffer',
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(iconv.decode(data, 'gb2312'));
|
||||
const list = $('table')
|
||||
.eq(37)
|
||||
.find('tr');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '停水通知 - 广州市自来水公司',
|
||||
link: 'http://www.gzwatersupply.com/stop/stopgl.html2?tab=9',
|
||||
item:
|
||||
list &&
|
||||
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(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue