From f3aee1b3b52dd9e64b8059bec526bbeb5a5f2556 Mon Sep 17 00:00:00 2001
From: Ethan Shen <42264778+nczitzk@users.noreply.github.com>
Date: Sat, 18 Jun 2022 23:23:11 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E5=8C=97=E4=BA=AC?=
=?UTF-8?q?=E5=B8=82=E6=95=99=E8=82=B2=E5=A7=94=E5=91=98=E4=BC=9A=E9=80=9A?=
=?UTF-8?q?=E7=9F=A5=E5=85=AC=E5=91=8A=20(#9978)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/government.md | 6 ++++
lib/v2/gov/beijing/jw/tzgg.js | 58 +++++++++++++++++++++++++++++++++
lib/v2/gov/maintainer.js | 1 +
lib/v2/gov/radar.js | 60 ++++++++++++++++++++---------------
lib/v2/gov/router.js | 1 +
5 files changed, 100 insertions(+), 26 deletions(-)
create mode 100644 lib/v2/gov/beijing/jw/tzgg.js
diff --git a/docs/government.md b/docs/government.md
index 2524d9caa..164c60647 100644
--- a/docs/government.md
+++ b/docs/government.md
@@ -44,6 +44,12 @@ pageClass: routes
+## 北京市教育委员会
+
+### 通知公告
+
+
+
## 北京市科学技术委员会、中关村科技园区管理委员会
### 频道
diff --git a/lib/v2/gov/beijing/jw/tzgg.js b/lib/v2/gov/beijing/jw/tzgg.js
new file mode 100644
index 000000000..2ac6e93b5
--- /dev/null
+++ b/lib/v2/gov/beijing/jw/tzgg.js
@@ -0,0 +1,58 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const timezone = require('@/utils/timezone');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const rootUrl = 'http://jw.beijing.gov.cn';
+ const currentUrl = `${rootUrl}/tzgg`;
+
+ const response = await got({
+ method: 'get',
+ url: currentUrl,
+ });
+
+ const $ = cheerio.load(response.data);
+
+ let items = $('.col-md a')
+ .toArray()
+ .map((item) => {
+ item = $(item);
+
+ const link = item.attr('href');
+
+ return {
+ title: item.text(),
+ link: /^http/.test(link) ? link : `${rootUrl}${link.replace(/^\./, '/tzgg')}`,
+ pubDate: parseDate(item.parent().find('span').text()),
+ };
+ });
+
+ items = await Promise.all(
+ items.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const detailResponse = await got({
+ method: 'get',
+ url: item.link,
+ });
+
+ const content = cheerio.load(detailResponse.data);
+
+ const pubDate = content('meta[name="PubDate"]').attr('content');
+
+ item.author = content('meta[name="ContentSource"]').attr('content');
+ item.pubDate = pubDate ? timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8) : item.pubDate;
+ item.description = content('.TRS_UEDITOR').html();
+
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: '北京市教育委员会 - 通知公告',
+ link: currentUrl,
+ item: items,
+ description: $('meta[name="ColumnDescription"]').attr('content'),
+ };
+};
diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js
index 9fe2b0e27..1cf372e54 100644
--- a/lib/v2/gov/maintainer.js
+++ b/lib/v2/gov/maintainer.js
@@ -18,6 +18,7 @@ module.exports = {
'/pbc/zcyj': ['Fatpandac'],
// province
'/anhui/kjt/:path?': ['nczitzk'],
+ '/beijing/jw/tzgg': ['nczitzk'],
'/beijing/kw/:channel': ['Fatpandac'],
'/hebei/czt/xwdt/:category?': ['nczitzk'],
'/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'],
diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js
index 602bff0b8..4d5f8e323 100644
--- a/lib/v2/gov/radar.js
+++ b/lib/v2/gov/radar.js
@@ -18,10 +18,18 @@ module.exports = {
},
'beijing.gov.cn': {
_name: '北京市人民政府',
+ jw: [
+ {
+ title: '北京市教育委员会通知公告',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-jiao-yu-wei-yuan-tong-zhi-gong-gao',
+ source: ['/tzgg'],
+ target: '/gov/beijing/jw/tzgg',
+ },
+ ],
kw: [
{
title: '北京市科委央地协同',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1132') {
@@ -31,7 +39,7 @@ module.exports = {
},
{
title: '北京市科委三城一区',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1134') {
@@ -41,7 +49,7 @@ module.exports = {
},
{
title: '北京市科委高精尖产业',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1136') {
@@ -51,7 +59,7 @@ module.exports = {
},
{
title: '北京市科委开放创新',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1138') {
@@ -61,7 +69,7 @@ module.exports = {
},
{
title: '北京市科委深化改革',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1140') {
@@ -71,7 +79,7 @@ module.exports = {
},
{
title: '北京市科委内设机构',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col746') {
@@ -81,7 +89,7 @@ module.exports = {
},
{
title: '北京市科委直属机构',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col748') {
@@ -91,7 +99,7 @@ module.exports = {
},
{
title: '北京市科委行政许可',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1520') {
@@ -101,7 +109,7 @@ module.exports = {
},
{
title: '北京市科委行政处罚',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1522') {
@@ -111,7 +119,7 @@ module.exports = {
},
{
title: '北京市科委行政确认',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1524') {
@@ -121,7 +129,7 @@ module.exports = {
},
{
title: '北京市科委行政奖励',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1526') {
@@ -131,7 +139,7 @@ module.exports = {
},
{
title: '行北京市科委政检查',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1528') {
@@ -141,7 +149,7 @@ module.exports = {
},
{
title: '北京市科委其他权力',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1542') {
@@ -151,7 +159,7 @@ module.exports = {
},
{
title: '北京市科委最新政策',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2380') {
@@ -161,7 +169,7 @@ module.exports = {
},
{
title: '北京市科委科技政策-科技法规规章文件',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2962' || params.channel === 'col2384') {
@@ -171,7 +179,7 @@ module.exports = {
},
{
title: '北京市科委科技政策-科委规范性文件',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2962' || params.channel === 'col2386') {
@@ -181,7 +189,7 @@ module.exports = {
},
{
title: '北京市科委科技政策-其他科技政策',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2962' || params.channel === 'col2388') {
@@ -191,7 +199,7 @@ module.exports = {
},
{
title: '北京市科委国家科技政策',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2964') {
@@ -201,7 +209,7 @@ module.exports = {
},
{
title: '北京市科委政策解读',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2396') {
@@ -211,7 +219,7 @@ module.exports = {
},
{
title: '北京市科委通知公告',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col736') {
@@ -221,7 +229,7 @@ module.exports = {
},
{
title: '北京市科委新闻中心',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col6382') {
@@ -231,7 +239,7 @@ module.exports = {
},
{
title: '北京市科委要闻',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col6344') {
@@ -241,7 +249,7 @@ module.exports = {
},
{
title: '北京市科委工作动态',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2330') {
@@ -251,7 +259,7 @@ module.exports = {
},
{
title: '北京市科委媒体报道',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col2332') {
@@ -261,7 +269,7 @@ module.exports = {
},
{
title: '北京市科委图片报道',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col6346') {
@@ -271,7 +279,7 @@ module.exports = {
},
{
title: '北京市科委政府网站年报专栏',
- docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-、-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-ke-xue-ji-shu-wei-yuan-hui-zhong-guan-cun-ke-ji-yuan-qu-guan-li-wei-yuan-hui',
source: ['/col/:channel/index.html'],
target: (params) => {
if (params.channel === 'col1008') {
diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js
index e010ef154..f14b030f9 100644
--- a/lib/v2/gov/router.js
+++ b/lib/v2/gov/router.js
@@ -18,6 +18,7 @@ module.exports = function (router) {
router.get('/pbc/zcyj', require('./pbc/zcyj'));
// province
router.get(/anhui\/kjt\/([\w\d/-]+)?/, require('./anhui/kjt'));
+ router.get('/beijing/jw/tzgg', require('./beijing/jw/tzgg'));
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
router.get('/hebei/czt/xwdt/:category?', require('./hebei/czt'));
router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index'));