From 06d1d824e94fd0ee3dfdb797cbcdf879e4f90d93 Mon Sep 17 00:00:00 2001 From: niuyi <30387148+niuyi1017@users.noreply.github.com> Date: Tue, 13 Sep 2022 12:49:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E4=BF=AE=E5=A4=8D=E4=B8=AD?= =?UTF-8?q?=E5=9B=BD=E4=BC=A0=E5=AA=92=E5=A4=A7=E5=AD=A6=E7=A0=94=E7=A9=B6?= =?UTF-8?q?=E7=94=9F=E6=8B=9B=E7=94=9F=E7=BD=91=20(#10767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复中国传媒大学研究生招生网 * fix(route):修复中国传媒大学研究生招生网 * fix(route): 修复中国传媒大学研究生招生网 Co-authored-by: 牛鑫语 --- docs/university.md | 2 +- lib/router.js | 2 +- lib/v2/cuc/maintainer.js | 3 +++ lib/v2/cuc/radar.js | 13 +++++++++++++ lib/v2/cuc/router.js | 3 +++ lib/{routes/universities => v2}/cuc/yz.js | 6 ++---- 6 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 lib/v2/cuc/maintainer.js create mode 100644 lib/v2/cuc/radar.js create mode 100644 lib/v2/cuc/router.js rename lib/{routes/universities => v2}/cuc/yz.js (91%) diff --git a/docs/university.md b/docs/university.md index 3001a1d6e..50bf25ddd 100644 --- a/docs/university.md +++ b/docs/university.md @@ -3229,7 +3229,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS ### 中国传媒大学研究生招生网 - + ## 中国地质大学 (武汉) diff --git a/lib/router.js b/lib/router.js index e74dd87ad..528ed28f1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -597,7 +597,7 @@ router.get('/cas/iee/kydt', lazyloadRouteHandler('./routes/universities/cas/iee/ router.get('/cas/cg/:caty?', lazyloadRouteHandler('./routes/universities/cas/cg/index')); // 中国传媒大学 -router.get('/cuc/yz', lazyloadRouteHandler('./routes/universities/cuc/yz')); +// router.get('/cuc/yz', lazyloadRouteHandler('./v2/cuc/yz')); // UTdallas ISSO router.get('/utdallas/isso', lazyloadRouteHandler('./routes/universities/utdallas/isso')); diff --git a/lib/v2/cuc/maintainer.js b/lib/v2/cuc/maintainer.js new file mode 100644 index 000000000..bc7c0e206 --- /dev/null +++ b/lib/v2/cuc/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/yz': ['niuyi1017'], +}; diff --git a/lib/v2/cuc/radar.js b/lib/v2/cuc/radar.js new file mode 100644 index 000000000..57e7e9088 --- /dev/null +++ b/lib/v2/cuc/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'cuc.edu.cn': { + _name: '中国传媒大学', + yz: [ + { + title: '研究生招生网', + docs: 'https://docs.rsshub.app/university.html#zhong-guo-chuan-mei-da-xue', + source: '/*', + target: '/', + }, + ], + }, +}; diff --git a/lib/v2/cuc/router.js b/lib/v2/cuc/router.js new file mode 100644 index 000000000..606afd65c --- /dev/null +++ b/lib/v2/cuc/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/yz', require('./yz')); +}; diff --git a/lib/routes/universities/cuc/yz.js b/lib/v2/cuc/yz.js similarity index 91% rename from lib/routes/universities/cuc/yz.js rename to lib/v2/cuc/yz.js index c9c72fa8a..00bd8d347 100644 --- a/lib/routes/universities/cuc/yz.js +++ b/lib/v2/cuc/yz.js @@ -1,6 +1,5 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -const url = require('url'); const iconv = require('iconv-lite'); const host = 'http://yz.cuc.edu.cn/'; @@ -18,13 +17,12 @@ module.exports = async (ctx) => { const $ = cheerio.load(responseHtml); const notice = $('#notice_area').children('.notice_block_top'); - const content = notice.children('.notice_content1').children(); - + const content = notice.children('.notice_content1').children('p'); const items = content .map((_, elem) => { const a = $('a', elem); return { - link: url.resolve(host, a.attr('href')), + link: new URL(a.attr('href'), host).href, title: a.text(), }; })