From cece722677ed10556667d64fcd28778352d7e78d Mon Sep 17 00:00:00 2001 From: "et al." <39025220+howfool@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:42:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20'=E5=9B=BD=E5=8A=A1=E9=99=A2?= =?UTF-8?q?=E4=BC=9A=E8=AE=AE'=20(#16768)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add route of '国务院会议' * Moved the route to gov folder * modified route path and example to fix a route not found error * fix: combine with existing route * fix: filter empty category --------- --- lib/routes/gov/cn/namespace.ts | 8 ++++++++ lib/routes/gov/{ => cn}/news/index.ts | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 lib/routes/gov/cn/namespace.ts rename lib/routes/gov/{ => cn}/news/index.ts (90%) diff --git a/lib/routes/gov/cn/namespace.ts b/lib/routes/gov/cn/namespace.ts new file mode 100644 index 000000000..9f7bf578c --- /dev/null +++ b/lib/routes/gov/cn/namespace.ts @@ -0,0 +1,8 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '中国政府网', + url: 'www.gov.cn/', + categories: ['government'], + description: '', +}; diff --git a/lib/routes/gov/news/index.ts b/lib/routes/gov/cn/news/index.ts similarity index 90% rename from lib/routes/gov/news/index.ts rename to lib/routes/gov/cn/news/index.ts index 28cc5c170..020f11d63 100644 --- a/lib/routes/gov/news/index.ts +++ b/lib/routes/gov/cn/news/index.ts @@ -7,9 +7,9 @@ import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { - path: '/news/:uid', + path: '/cn/news/:uid', categories: ['government'], - example: '/gov/news/bm', + example: '/gov/cn/news/bm', parameters: { uid: '分类名' }, features: { requireConfig: false, @@ -20,11 +20,11 @@ export const route: Route = { supportScihub: false, }, name: '政府新闻', - maintainers: ['EsuRt'], + maintainers: ['EsuRt', 'howfool'], handler, - description: `| 政务部门 | 滚动新闻 | 新闻要闻 | 国务院新闻 | 政策文件 | - | :------: | :------: | :------: | :--------: | :------: | - | bm | gd | yw | gwy | zhengce |`, + description: `| 政务部门 | 滚动新闻 | 新闻要闻 | 国务院新闻 | 国务院工作会议 | 政策文件 | +| :------: | :------: | :------: | :--------: | :------------: | :------: | +| bm | gd | yw | gwy | gwyzzjg | zhengce |`, }; async function handler(ctx) { @@ -55,6 +55,10 @@ async function handler(ctx) { url = 'http://sousuo.gov.cn/s.htm?t=zhengcelibrary'; title = '中国政府网 - 政策文件'; break; + case 'gwyzzjg': + url = `${originDomain}/gwyzzjg/huiyi/`; + title = '中国政府网 - 国务院工作会议'; + break; default: logger.error('pattern not matched'); } @@ -119,7 +123,7 @@ async function handler(ctx) { link: contentUrl, pubDate, author, - category, + category: category.filter(Boolean), }; }); })