Skip to content

Commit

Permalink
feat(route): '国务院会议' (#16768)
Browse files Browse the repository at this point in the history
* 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

---------
  • Loading branch information
howfool committed Sep 17, 2024
1 parent 20dfcb9 commit cece722
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
8 changes: 8 additions & 0 deletions lib/routes/gov/cn/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: '中国政府网',
url: 'www.gov.cn/',
categories: ['government'],
description: '',
};
18 changes: 11 additions & 7 deletions lib/routes/gov/news/index.ts → lib/routes/gov/cn/news/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -119,7 +123,7 @@ async function handler(ctx) {
link: contentUrl,
pubDate,
author,
category,
category: category.filter(Boolean),
};
});
})
Expand Down

0 comments on commit cece722

Please sign in to comment.