diff --git a/docs/government.md b/docs/government.md index e54fab715d..182ed343d7 100644 --- a/docs/government.md +++ b/docs/government.md @@ -106,13 +106,13 @@ pageClass: routes ## 德阳市人民政府 -### 德阳市政府公开信息 +### 政府公开信息 ## 广东省人民政府 -### 广东省教育厅 +### 省教育厅 @@ -122,7 +122,7 @@ pageClass: routes -### 广东省教育考试院 +### 省教育考试院 @@ -132,7 +132,7 @@ pageClass: routes -### 广东省深圳市人民政府 +### 深圳市人民政府 diff --git a/lib/router.js b/lib/router.js index 9dec3517c0..063bb5e9a5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1233,7 +1233,7 @@ router.get('/gov/guangdong/edu/:caty', lazyloadRouteHandler('./routes/gov/guangd router.get('/gov/guangdong/eea/:caty', lazyloadRouteHandler('./routes/gov/guangdong/eea')); // 广东省深圳市 -router.get('/gov/shenzhen/xxgk/zfxxgj/:caty', lazyloadRouteHandler('./routes/gov/shenzhen/xxgk/zfxxgj')); +// router.get('/gov/shenzhen/xxgk/zfxxgj/:caty', lazyloadRouteHandler('./routes/gov/shenzhen/xxgk/zfxxgj')); // 日本国外務省記者会見 router.get('/go.jp/mofa', lazyloadRouteHandler('./routes/go.jp/mofa/main')); diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js index ce79c3459e..c4c1a972cd 100644 --- a/lib/v2/gov/maintainer.js +++ b/lib/v2/gov/maintainer.js @@ -44,11 +44,12 @@ module.exports = { '/hebei/czt/xwdt/:category?': ['nczitzk'], '/huizhou/zwgk/:category?': ['Fatpandac'], '/shaanxi/kjt/:id?': ['nczitzk'], - '/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'], - '/shenzhen/zzb/:caty/:page?': ['zlasd'], '/shanghai/rsj/ksxm': ['Fatpandac'], - '/shanghai/yjj/:path+': ['nczitzk'], '/shanghai/wsjkw/yqtb': ['zcf0508'], + '/shanghai/yjj/:path+': ['nczitzk'], + '/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'], + '/shenzhen/xxgk/zfxxgj/:caty': ['laoxua'], + '/shenzhen/zzb/:caty/:page?': ['zlasd'], '/sichuan/deyang/govpulicinfo/:countyName': ['zytomorrow'], '/taiyuan/rsj/:caty/:page?': ['2PoL'], '/xuzhou/hrss/:category?': ['nczitzk'], diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js index 090db1579e..3e7148f223 100644 --- a/lib/v2/gov/radar.js +++ b/lib/v2/gov/radar.js @@ -720,6 +720,14 @@ module.exports = { target: '/gov/shenzhen/hrss/szksy/:caty/:page?', }, ], + xxgk: [ + { + title: '深圳市人民政府', + docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-shen-zhen-shi-ren-min-zheng-fu', + source: ['/cn/xxgk/zfxxgj/:caty'], + target: '/gov/shenzhen/hrss/szksy/:caty/:page?', + }, + ], zzb: [ { title: '组工在线公告', diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js index 4fd34ba2ae..466b2eae76 100644 --- a/lib/v2/gov/router.js +++ b/lib/v2/gov/router.js @@ -36,11 +36,12 @@ module.exports = function (router) { router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index')); router.get('/hebei/czt/xwdt/:category?', require('./hebei/czt')); router.get('/shaanxi/kjt/:id?', require('./shaanxi/kjt')); - router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index')); - router.get('/shenzhen/zzb/:caty/:page?', require('./shenzhen/zzb/index')); router.get('/shanghai/rsj/ksxm', require('./shanghai/rsj/ksxm')); - router.get(/shanghai\/yjj\/([\w/-]+)?/, require('./shanghai/yjj')); router.get('/shanghai/wsjkw/yqtb', require('./shanghai/wsjkw/yqtb')); + router.get(/shanghai\/yjj\/([\w/-]+)?/, require('./shanghai/yjj')); + router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index')); + router.get('/shenzhen/xxgk/zfxxgj/:caty', require('./shenzhen/xxgk/zfxxgj')); + router.get('/shenzhen/zzb/:caty/:page?', require('./shenzhen/zzb/index')); router.get('/sichuan/deyang/govpulicinfo/:countyName', require('./sichuan/deyang/govpulicinfo')); router.get('/taiyuan/rsj/:caty/:page?', require('./taiyuan/rsj')); router.get('/xuzhou/hrss/:category?', require('./xuzhou/hrss')); diff --git a/lib/routes/gov/shenzhen/xxgk/zfxxgj.js b/lib/v2/gov/shenzhen/xxgk/zfxxgj.js similarity index 56% rename from lib/routes/gov/shenzhen/xxgk/zfxxgj.js rename to lib/v2/gov/shenzhen/xxgk/zfxxgj.js index 53d776f0c9..a1a2ff5357 100644 --- a/lib/routes/gov/shenzhen/xxgk/zfxxgj.js +++ b/lib/v2/gov/shenzhen/xxgk/zfxxgj.js @@ -1,7 +1,7 @@ -const url = require('url'); const got = require('@/utils/got'); const cheerio = require('cheerio'); - +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); const rootUrl = 'http://www.sz.gov.cn/cn/xxgk/zfxxgj/'; const config = { @@ -26,33 +26,39 @@ const config = { module.exports = async (ctx) => { const cfg = config[ctx.params.caty]; if (!cfg) { - throw Error('Bad category. See docs'); + throw Error('Bad category. See docs'); } - const currentUrl = url.resolve(rootUrl, cfg.link); - const response = await got({ method: 'get', url: currentUrl }); + const currentUrl = new URL(cfg.link, rootUrl).href; + const response = await got(currentUrl); const $ = cheerio.load(response.data); const list = $('div.zx_ml_list ul li span.tit') - .map((_, item) => { + .toArray() + .map((item) => { item = $(item).find('a'); return { title: item.text(), link: item.attr('href'), }; - }) - .get(); + }); const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ method: 'get', url: item.link }); + const detailResponse = await got(item.link); const content = cheerio.load(detailResponse.data); - item.description = content('div.concent_center').html(); - item.pubDate = new Date( - content('td[align="right"]') - .text() - .replace(/发布日期:/, '') + ' GMT+8' - ).toUTCString(); + item.description = content('div.news_cont_d_wrap').html(); + if (content('div.fjdown').html() !== null) { + item.description += content('div.fjdown').html(); + } + item.pubDate = timezone( + parseDate( + content('.tit span:nth-child(2)') + .text() + .replace(/信息提供日期:/, '') + ), + 8 + ); return item; }) )