diff --git a/docs/government.md b/docs/government.md index 164c60647e..eeab0f3ad3 100644 --- a/docs/government.md +++ b/docs/government.md @@ -522,6 +522,18 @@ pageClass: routes +## 徐州市人民政府 + +### 徐州市人力资源和社会保障局 + + + +| 通知公告 | 要闻动态 | 县区动态 | 事业招聘 | 企业招聘 | 政声传递 | +| ---- | ------ | ------ | ------ | ------ | ------ | +| | 001001 | 001002 | 001004 | 001005 | 001006 | + + + ## 浙江省土地使用权网上交易系统 ### 公告信息 diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js index 1cf372e542..eac595989c 100644 --- a/lib/v2/gov/maintainer.js +++ b/lib/v2/gov/maintainer.js @@ -29,4 +29,5 @@ module.exports = { '/guangdong/tqyb/sncsyjxh': ['Fatpandac'], '/huizhou/zwgk/:category?': ['Fatpandac'], '/sichuan/deyang/govpulicinfo/:countyName': ['zytomorrow'], + '/xuzhou/hrss/:category?': ['nczitzk'], }; diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js index 4d5f8e323a..146e3882e1 100644 --- a/lib/v2/gov/radar.js +++ b/lib/v2/gov/radar.js @@ -545,4 +545,15 @@ module.exports = { }, ], }, + 'xz.gov.cn': { + _name: '徐州市人民政府', + hrss: [ + { + title: '徐州市人力资源和社会保障局', + docs: 'https://docs.rsshub.app/government.html#xu-zhou-shi-ren-min-zheng-fu-xu-zhou-shi-ren-li-zi-yuan-he-she-hui-bao-zhang-ju', + source: ['/*'], + target: (params, url) => `/gov/xuzhou/hrss${new URL(url).href.match(/\/(\d+)\/subPage.html/)[1] ?? ''}`, + }, + ], + }, }; diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js index f14b030f95..28602006f2 100644 --- a/lib/v2/gov/router.js +++ b/lib/v2/gov/router.js @@ -29,4 +29,5 @@ module.exports = function (router) { router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh')); router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index')); router.get('/sichuan/deyang/govpulicinfo/:countyName', require('./sichuan/deyang/govpulicinfo')); + router.get('/xuzhou/hrss/:category?', require('./xuzhou/hrss')); }; diff --git a/lib/v2/gov/xuzhou/hrss.js b/lib/v2/gov/xuzhou/hrss.js new file mode 100644 index 0000000000..63505d5ef9 --- /dev/null +++ b/lib/v2/gov/xuzhou/hrss.js @@ -0,0 +1,54 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const category = ctx.params.category ?? ''; + + const rootUrl = 'http://hrss.xz.gov.cn'; + const currentUrl = `${rootUrl}${category ? `/001/${category}/subPage.html` : ''}`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + let items = (category ? $('.module-items a') : $('.bdl[data-target="1"]').eq(1).find('a')).toArray().map((item) => { + item = $(item); + + const link = item.attr('href'); + + return { + title: item.attr('title'), + link: `${/^http/.test(link) ? '' : rootUrl}${item.attr('href')}`, + }; + }); + + items = await Promise.all( + items.map((item) => + ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + + const content = cheerio.load(detailResponse.data); + + item.description = content('#Zoom, .mian-cont, .ewb-article-info, #UCAP-CONTENT').html(); + item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8); + item.category = content('meta[name="Keywords"]').attr('content')?.split(' '); + + return item; + }) + ) + ); + + ctx.state.data = { + title: `徐州市人力资源和社会保障局 - ${category ? $('.wb-tree-items.current').text() : '通知公告'}`, + link: currentUrl, + item: items, + }; +};