diff --git a/docs/forecast.md b/docs/forecast.md
index 647cb38c2..3e9aa8f8d 100644
--- a/docs/forecast.md
+++ b/docs/forecast.md
@@ -32,6 +32,16 @@ pageClass: routes
+## 广州天气
+
+### 突发性天气提示
+
+
+
+
{{ content }}
diff --git a/lib/v2/gov/guangdong/tqyb/tfxtq.js b/lib/v2/gov/guangdong/tqyb/tfxtq.js new file mode 100644 index 000000000..cfb299b35 --- /dev/null +++ b/lib/v2/gov/guangdong/tqyb/tfxtq.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); +const { parseDate } = require('@/utils/parse-date'); + +const rootUrl = 'http://www.tqyb.com.cn'; + +module.exports = async (ctx) => { + const tfxtqJsUrl = `${rootUrl}/data/gzWeather/weatherTips.js`; + + const response = await got.get(tfxtqJsUrl); + const data = JSON.parse(`[{${response.data.match(/Tips = {(.*?)}/)[1]}}]`); + + const items = data.map((item) => ({ + title: item.title, + link: 'http://www.tqyb.com.cn/gz/weatherAlarm/suddenWeather/', + author: item.issuer, + description: art(path.join(__dirname, './templates/tfxtq.art'), { + content: item.content, + }), + pubDate: parseDate(item.ddate), + guid: parseDate(item.ddate) + item.title, + })); + + ctx.state.data = { + title: '突发性天气提示', + link: 'http://www.tqyb.com.cn/gz/weatherAlarm/suddenWeather/', + item: items, + }; +}; diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js new file mode 100644 index 000000000..a1d45dc4d --- /dev/null +++ b/lib/v2/gov/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/guangdong/tqyb/tfxtq': ['Fatpandac'], + '/guangdong/tqyb/sncsyjxh': ['Fatpandac'], +}; diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js new file mode 100644 index 000000000..27b4a5171 --- /dev/null +++ b/lib/v2/gov/radar.js @@ -0,0 +1,19 @@ +module.exports = { + 'tqyb.com.cn': { + _name: '广州天气', + www: [ + { + title: '突发性天气提示', + docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi', + source: ['/gz/weatherAlarm/suddenWeather/'], + target: '/gov/guangdong/tqyb/tfxtq', + }, + { + title: '广东省内城市预警信号', + docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao', + source: ['/gz/weatherAlarm/otherCity/'], + target: '/gov/guangdong/tqyb/sncsyjxh', + }, + ], + }, +}; diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js new file mode 100644 index 000000000..bf10a4ead --- /dev/null +++ b/lib/v2/gov/router.js @@ -0,0 +1,4 @@ +module.exports = function (router) { + router.get('/guangdong/tqyb/tfxtq', require('./guangdong/tqyb/tfxtq')); + router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh')); +};