From 3bae792736de443d440a343bb9be934516910cd6 Mon Sep 17 00:00:00 2001 From: evnydd0sf <16290402+evnydd0sf@users.noreply.github.com> Date: Thu, 18 Aug 2022 21:41:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=97=E4=BA=AC=E8=89=BA=E6=9C=AF?= =?UTF-8?q?=E5=AD=A6=E9=99=A2=E7=A0=94=E7=A9=B6=E7=94=9F=E9=99=A2=20(#1052?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 南京艺术学院研究生院 * Update lib/v2/nua/gra.js Co-authored-by: Tony * Update lib/v2/nua/gra.js Co-authored-by: Tony * Update lib/v2/nua/gra.js Co-authored-by: Tony * Update lib/v2/nua/radar.js Co-authored-by: Tony * Update lib/v2/nua/radar.js Co-authored-by: Tony * Update lib/v2/nua/gra.js Co-authored-by: Tony * Update lib/v2/nua/gra.js Co-authored-by: Tony * Update docs/university.md Co-authored-by: Tony * Update docs/university.md --- docs/university.md | 15 +++++++++++ lib/v2/nua/gra.js | 56 ++++++++++++++++++++++++++++++++++++++++ lib/v2/nua/maintainer.js | 3 +++ lib/v2/nua/radar.js | 13 ++++++++++ lib/v2/nua/router.js | 3 +++ 5 files changed, 90 insertions(+) create mode 100644 lib/v2/nua/gra.js create mode 100644 lib/v2/nua/maintainer.js create mode 100644 lib/v2/nua/radar.js create mode 100644 lib/v2/nua/router.js diff --git a/docs/university.md b/docs/university.md index 737dde1ac5..77542a19fd 100644 --- a/docs/university.md +++ b/docs/university.md @@ -2073,6 +2073,21 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 南京艺术学院 + +### 研究生处 + + + +| 种类名 | 参数 | +| ----- | ---- | +| 招生工作 | 1959 | +| 培养工作 | 1962 | +| 学位工作 | 1958 | +| 思政与管理 | 1960 | + + + ## 清华大学 ### 清华大学校内信息发布平台 diff --git a/lib/v2/nua/gra.js b/lib/v2/nua/gra.js new file mode 100644 index 0000000000..be538fb3ba --- /dev/null +++ b/lib/v2/nua/gra.js @@ -0,0 +1,56 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); +const baseUrl = 'https://grad.nua.edu.cn'; + +module.exports = async (ctx) => { + const type = ctx.params.type; + const newsUrl = `${baseUrl}/${type}/list.htm`; + + const response = await got(newsUrl, { + https: { + rejectUnauthorized: false, + }, + }); + + const data = response.data; + const $ = cheerio.load(data); + const pagename = $('.col_title').text(); + + const items = $('li.list_item') + .toArray() + .map((item) => { + item = $(item); + return { + link: baseUrl + item.find('a').attr('href'), + title: item.find('a').attr('title'), + pubDate: timezone(parseDate(item.find('.Article_PublishDate').first().text(), 'YYYY-MM-DD'), +8), + }; + }); + + const results = await Promise.all( + items.map((item) => + ctx.cache.tryGet(item.link, async () => { + const result = await got(item.link, { + https: { + rejectUnauthorized: false, + }, + }); + const $ = cheerio.load(result.data); + + item.author = $('.arti_publisher').text(); + item.description = $('.read').html(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: 'NUA-研究生处-' + pagename, + link: `${baseUrl}/${type}/list.htm`, + description: '南京艺术学院研究生处' + pagename, + item: results, + }; +}; diff --git a/lib/v2/nua/maintainer.js b/lib/v2/nua/maintainer.js new file mode 100644 index 0000000000..187c84ed13 --- /dev/null +++ b/lib/v2/nua/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/gra/:type': ['evnydd0sf'], +}; diff --git a/lib/v2/nua/radar.js b/lib/v2/nua/radar.js new file mode 100644 index 0000000000..a7e471ef03 --- /dev/null +++ b/lib/v2/nua/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'nua.edu.cn': { + _name: '南京艺术学院', + grad: [ + { + title: '研究生处', + docs: 'https://docs.rsshub.app/university.html#nan-jing-yi-shu-xue-yuan', + source: ['/:type/list.htm'], + target: '/nua/gra/:type', + }, + ], + }, +}; diff --git a/lib/v2/nua/router.js b/lib/v2/nua/router.js new file mode 100644 index 0000000000..0157a1edbc --- /dev/null +++ b/lib/v2/nua/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/gra/:type', require('./gra')); +};