mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat(route): 支持上海市文旅局审批公告 (#12862)
* feat(route): 支持上海市文旅局审批公告 * fix(route): wgj * fix(route): currentUrl * fix(route): search params
This commit is contained in:
@@ -846,6 +846,11 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
### 上海市文旅局审批公告
|
||||
|
||||
<Route author="gideonsenku" example="/gov/shanghai/wgj" path="/gov/shanghai/wgj/:page?" :paramsDesc="['页数,默认第 1 页']" radar="1">
|
||||
</Route>
|
||||
|
||||
## 世界贸易组织
|
||||
|
||||
### 争端解决新闻
|
||||
|
||||
@@ -73,6 +73,7 @@ module.exports = {
|
||||
'/shanghai/rsj/ksxm': ['Fatpandac'],
|
||||
'/shanghai/wsjkw/yqtb': ['zcf0508'],
|
||||
'/shanghai/yjj/:path+': ['nczitzk'],
|
||||
'/shanghai/wgj/:page?': ['gideonsenku'],
|
||||
'/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'],
|
||||
'/shenzhen/xxgk/zfxxgj/:caty': ['laoxua'],
|
||||
'/shenzhen/zzb/:caty/:page?': ['zlasd'],
|
||||
|
||||
@@ -948,6 +948,14 @@ module.exports = {
|
||||
target: (params, url) => `/gov/shanghai/yjj/${new URL(url).match(/yjj\.sh\.gov\.cn\/(.*)\/index.html/)[1]}`,
|
||||
},
|
||||
],
|
||||
'wsbs.wgj': [
|
||||
{
|
||||
title: '上海市文旅局审批公告',
|
||||
docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-ren-min-zheng-fu-shang-hai-shi-wen-lv-ju-shen-pi-gong-gao',
|
||||
source: ['/'],
|
||||
target: '/gov/shanghai/wgj',
|
||||
},
|
||||
],
|
||||
},
|
||||
'shaanxi.gov.cn': {
|
||||
_name: '陕西省人民政府',
|
||||
|
||||
@@ -63,6 +63,7 @@ module.exports = function (router) {
|
||||
router.get('/shaanxi/kjt/:id?', require('./shaanxi/kjt'));
|
||||
router.get('/shanghai/rsj/ksxm', require('./shanghai/rsj/ksxm'));
|
||||
router.get('/shanghai/wsjkw/yqtb', require('./shanghai/wsjkw/yqtb'));
|
||||
router.get('/shanghai/wgj/:page?', require('./shanghai/wgj/wgj'));
|
||||
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'));
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<text>举办单位:{{ hostingUnit }} </text>
|
||||
<br>
|
||||
<text>许可证号:{{ licenseNumber }} </text>
|
||||
<br>
|
||||
<text>演出名称:{{ performanceName }} </text>
|
||||
<br>
|
||||
<text>演出日期:{{ performanceDate }} </text>
|
||||
<br>
|
||||
<text>演出场所:{{ performanceVenue }} </text>
|
||||
<br>
|
||||
<text>主要演员:{{ mainActors }} </text>
|
||||
<br>
|
||||
<text>演员人数:{{ actorCount }} </text>
|
||||
<br>
|
||||
<text>场次:{{ showCount }} </text>
|
||||
@@ -0,0 +1,72 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'http://wsbs.wgj.sh.gov.cn';
|
||||
const currentUrl = `${baseUrl}/shwgj_ywtb/core/web/welcome/index!toResultNotice.action`;
|
||||
const page = ctx.params.page ?? 1;
|
||||
const searchParams = {
|
||||
flag: 1,
|
||||
'pageDoc.pageNo': page,
|
||||
};
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: currentUrl,
|
||||
searchParams,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('#div_md > table > tbody > tr > td:nth-child(1) > a')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.prop('innerText').replace(/\s/g, ''),
|
||||
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: baseUrl + item.link,
|
||||
});
|
||||
const $ = cheerio.load(detailResponse.data);
|
||||
const dateElement = $('div[align="right"][style*="padding: 10px"]').last();
|
||||
const dateText = dateElement.text().trim();
|
||||
const hostingUnit = $('td:contains("举办单位:")').next().text().trim();
|
||||
const licenseNumber = $('td:contains("许可证号:")').next().text().trim();
|
||||
const performanceName = $('td:contains("演出名称:")').next().text().trim();
|
||||
const performanceDate = $('td:contains("演出日期:")').next().text().trim();
|
||||
const performanceVenue = $('td:contains("演出场所:")').next().text().trim();
|
||||
const mainActors = $('td:contains("主要演员:")').next().text().trim();
|
||||
const actorCount = $('td:contains("演员人数:")').next().text().trim();
|
||||
const showCount = $('td:contains("场次:")').next().text().trim();
|
||||
|
||||
item.description = art(path.join(__dirname, './templates/wgj.art'), {
|
||||
hostingUnit,
|
||||
licenseNumber,
|
||||
performanceName,
|
||||
performanceDate,
|
||||
performanceVenue,
|
||||
mainActors,
|
||||
actorCount,
|
||||
showCount,
|
||||
});
|
||||
item.pubDate = parseDate(dateText);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user