From 5c14f8a591bc82a90ddbd5213ba5f962077088a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=99=BD?= <39430235+3401797899@users.noreply.github.com>
Date: Wed, 26 Jul 2023 03:32:51 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E4=B8=AD=E5=9B=BD?=
=?UTF-8?q?=E6=B5=B7=E6=B4=8B=E5=A4=A7=E5=AD=A6=E6=95=99=E5=8A=A1=E5=A4=84?=
=?UTF-8?q?=20(#12872)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(route): add 中国海洋大学教务处
* fix: sort entries
---------
---
docs/university.md | 4 ++++
lib/v2/ouc/jwc.js | 39 +++++++++++++++++++++++++++++++++++++++
lib/v2/ouc/maintainer.js | 1 +
lib/v2/ouc/radar.js | 14 +++++++++++---
lib/v2/ouc/router.js | 1 +
5 files changed, 56 insertions(+), 3 deletions(-)
create mode 100644 lib/v2/ouc/jwc.js
diff --git a/docs/university.md b/docs/university.md
index 0a8ea9854f..c676883c08 100644
--- a/docs/university.md
+++ b/docs/university.md
@@ -3665,6 +3665,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
+### 教务处
+
+
+
## 中国科学技术大学
### 官网通知公告
diff --git a/lib/v2/ouc/jwc.js b/lib/v2/ouc/jwc.js
new file mode 100644
index 0000000000..b1099775de
--- /dev/null
+++ b/lib/v2/ouc/jwc.js
@@ -0,0 +1,39 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const link = 'https://jwc.ouc.edu.cn/6517/list.htm';
+ const response = await got(link);
+ const $ = cheerio.load(response.data);
+ const list = $('.wp_article_list li')
+ .toArray()
+ .map((e) => {
+ e = $(e);
+ const a = e.find('a');
+ return {
+ title: a.attr('title'),
+ link: a.attr('href'),
+ pubDate: parseDate(e.find('span.Article_PublishDate').text(), 'YYYY-MM-DD'),
+ };
+ });
+
+ const out = await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const response = await got('https://jwc.ouc.edu.cn' + item.link);
+ const $ = cheerio.load(response.data);
+ item.author = '中国海洋大学教务处';
+ item.description = $('.wp_articlecontent').html();
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: '中国海洋大学教务处',
+ link,
+ description: '中国海洋大学教务处最新通知',
+ item: out,
+ };
+};
diff --git a/lib/v2/ouc/maintainer.js b/lib/v2/ouc/maintainer.js
index bbddc647c7..dc547d7720 100644
--- a/lib/v2/ouc/maintainer.js
+++ b/lib/v2/ouc/maintainer.js
@@ -1,5 +1,6 @@
module.exports = {
'/it/postgraduate': ['shengmaosu'],
'/it/:type?': ['GeoffreyChen777'],
+ '/jwc': ['3401797899'],
'/yjs': ['shengmaosu'],
};
diff --git a/lib/v2/ouc/radar.js b/lib/v2/ouc/radar.js
index 4e5ded8e74..6399cbc262 100644
--- a/lib/v2/ouc/radar.js
+++ b/lib/v2/ouc/radar.js
@@ -1,18 +1,26 @@
module.exports = {
'ouc.edu.cn': {
_name: '中国海洋大学',
+ jwc: [
+ {
+ title: '教务处',
+ docs: 'https://docs.rsshub.app/university.html#zhong-guo-hai-yang-da-xue',
+ source: ['/', '/6517/list.htm'],
+ target: '/ouc/jwc',
+ },
+ ],
it: [
{
title: '信息科学与工程学院',
docs: 'https://docs.rsshub.app/university.html#zhong-guo-hai-yang-da-xue',
source: ['/'],
- target: '/ocu/it',
+ target: '/ouc/it',
},
{
title: '信息科学与工程学院研究生招生通知公告',
docs: 'https://docs.rsshub.app/university.html#zhong-guo-hai-yang-da-xue',
source: ['/_s381/16619/list.psp', '/16619/list.htm', '/'],
- target: '/ocu/it/postgraduate',
+ target: '/ouc/it/postgraduate',
},
],
yz: [
@@ -20,7 +28,7 @@ module.exports = {
title: '研究生院',
docs: 'https://docs.rsshub.app/university.html#zhong-guo-hai-yang-da-xue',
source: ['/5926/list.htm'],
- target: '/ocu/yjs',
+ target: '/ouc/yjs',
},
],
},
diff --git a/lib/v2/ouc/router.js b/lib/v2/ouc/router.js
index 762e8ef293..96f4ae3297 100644
--- a/lib/v2/ouc/router.js
+++ b/lib/v2/ouc/router.js
@@ -1,5 +1,6 @@
module.exports = (router) => {
router.get('/it/postgraduate', require('./it-postgraduate'));
router.get('/it/:type?', require('./it'));
+ router.get('/jwc', require('./jwc'));
router.get('/yjs', require('./yjs'));
};