Add(route): add 深圳市委组织部 & 深圳考试院 (#8851)

Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
zlasd 2022-01-23 03:55:58 +08:00 committed by GitHub
parent 3606f56703
commit 4df468d36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 127 additions and 0 deletions

View File

@ -96,6 +96,26 @@ pageClass: routes
</Route>
### 深圳市委组织部
<Route author="zlasd" example="/gov/shenzhen/zzb/tzgg" path="/gov/shenzhen/zzb/:caty/:page?" :paramsDesc="['信息类别', '页码']">
| 通知公告 | 任前公示 | 政策法规 | 工作动态 | 部门预算决算公开 | 业务表格下载 |
| :------: | :------: | :------: | :------: | :--------------: | :----------: |
| tzgg | rqgs | zcfg | gzdt | xcbd | bgxz |
</Route>
### 深圳市考试院
<Route author="zlasd" example="/gov/shenzhen/hrss/szksy/bmxx/2" path="/gov/shenzhen/hrss/szksy/:caty/:page?" :paramsDesc="['信息类别', '页码']">
| 通知公告 | 报名信息 | 成绩信息 | 合格标准 | 合格人员公示 | 证书发放信息 |
| :------: | :------: | :------: | :------: | :----------: | :----------: |
| tzgg | bmxx | cjxx | hgbz | hgrygs | zsff |
</Route>
## 国家税务总局
### 最新文件

View File

@ -1,4 +1,6 @@
module.exports = {
'/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'],
'/shenzhen/zzb/:caty/:page?': ['zlasd'],
'/shanghai/rsj/ksxm': ['Fatpandac'],
'/guangdong/tqyb/tfxtq': ['Fatpandac'],
'/guangdong/tqyb/sncsyjxh': ['Fatpandac'],

View File

@ -1,4 +1,26 @@
module.exports = {
'hrss.sz.gov.cn': {
_name: '深圳考试院',
'.': [
{
title: '公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu',
source: ['/*'],
target: '/gov/shenzhen/hrss/szksy/:caty/:page?',
},
],
},
'zzb.sz.gov.cn': {
_name: '深圳组工在线',
www: [
{
title: '公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan',
source: ['/*'],
target: '/gov/shenzhen/zzb/:caty/:page?',
},
],
},
'rsj.sh.gov.cn': {
_name: '上海市职业能力考试院',
'.': [

View File

@ -1,4 +1,6 @@
module.exports = function (router) {
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('/guangdong/tqyb/tfxtq', require('./guangdong/tqyb/tfxtq'));
router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh'));

View File

@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const rootURL = 'http://hrss.sz.gov.cn/';
module.exports = async (ctx) => {
const categoryID = ctx.params.caty;
const page = ctx.params.page ?? '1';
const pageParam = parseInt(page) > 1 ? `_${page}` : '';
const pagePath = `/szksy/zwgk/${categoryID}/index${pageParam}.html`;
const currentURL = new URL(pagePath, rootURL); // do not use deprecated 'url.resolve'
const response = await got({ method: 'get', url: currentURL });
if (response.statusCode !== 200) {
throw new Error(response.statusMessage);
}
const $ = cheerio.load(response.data);
const title = $('.zx_rm_tit span').text().trim();
const list = $('.zx_ml_list ul li')
.slice(1)
.map((_, item) => {
const tag = $(item).find('div.list_name a');
const tag2 = $(item).find('span:eq(1)');
return {
title: tag.text().trim(),
link: tag.attr('href'),
pubDate: timezone(parseDate(tag2.text().trim(), 'YYYY/MM/DD'), 0),
};
})
.get();
ctx.state.data = {
title: '深圳市考试院 - ' + title,
link: currentURL.href,
item: list,
};
};

View File

@ -0,0 +1,40 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const rootURL = 'http://www.zzb.sz.gov.cn/';
module.exports = async (ctx) => {
const categoryID = ctx.params.caty;
const page = ctx.params.page ?? '1';
const pageParam = parseInt(page) > 1 ? `_${page}` : '';
const pagePath = `/${categoryID}/index${pageParam}.html`;
const currentURL = new URL(pagePath, rootURL); // do not use deprecated 'url.resolve'
const response = await got({ method: 'get', url: currentURL });
if (response.statusCode !== 200) {
throw new Error(response.statusMessage);
}
const $ = cheerio.load(response.data);
const title = $('#Title').text().trim();
const list = $('#List tbody tr td table tbody tr td[width="96%"]')
.map((_, item) => {
const tag = $(item).find('font a');
const tag2 = $(item).find('font[size="2px"]');
return {
title: tag.text(),
link: tag.attr('href'),
pubDate: timezone(parseDate(tag2.text().trim(), 'YYYY/MM/DD'), 0),
};
})
.get();
ctx.state.data = {
title: '深圳组工在线 - ' + title,
link: currentURL.href,
item: list,
};
};