fix: #18771 gov stats description error (#18773)

* fix(route/gov/stats): corrected the `description` and `author`

fix #18771

* docs(route/gov/stats): correct the example path

* refactor(route/gov/stats): fetch the item.author directly

* refactor(route/gov/stats): remove the always false condition
This commit is contained in:
Mervyn Zhan
2025-04-05 09:21:55 -07:00
committed by GitHub
parent 0f43236cae
commit 64a9bfe47f
+4 -8
View File
@@ -16,8 +16,8 @@ export const route: Route = {
name: '国家统计局 通用',
url: 'www.stats.gov.cn',
categories: ['government'],
maintainers: ['bigfei', 'nczitzk'],
example: '/stats/sj/zxfb',
maintainers: ['bigfei', 'nczitzk', 'reply2future'],
example: '/gov/stats/sj/zxfb',
handler,
radar: [
{
@@ -108,18 +108,14 @@ async function handler(ctx) {
return item;
}
try {
item.author = detailResponse.data.match(/来源:(.*?)</)[1].trim();
} catch {
item.author = content('div.detail-title-des h2 span').first().text().split(':').pop().trim();
}
item.author = detailResponse.match(/来源:(.*?)</)?.[1]?.trim();
content('.pchide').remove();
item.title = item.title || content('div.detail-title h1').text();
item.pubDate = timezone(parseDate(content('div.detail-title-des h2 p, .info').first().text().trim()), +8);
item.description = art(path.join(__dirname, 'templates/description.art'), {
description: content('.TRS_Editor').html(),
description: content('.TRS_Editor').html() || content('.TRS_UEDITOR').html(),
attachments: content('a[oldsrc]')
.toArray()
.map((a) => {