diff --git a/docs/university.md b/docs/university.md index 9e4a009357..3141d7caea 100644 --- a/docs/university.md +++ b/docs/university.md @@ -392,7 +392,13 @@ category 列表: ### 学校通知 - + + +| 学校新闻 | 学校通知 | 学校文件 | 学术动态 | +| -------- | -------- | -------- | ----------- | +| news | notice | file | scholarship | + + ## 华南理工大学 diff --git a/lib/router.js b/lib/router.js index b3f32a5ee6..7c8985aa85 100644 --- a/lib/router.js +++ b/lib/router.js @@ -724,7 +724,10 @@ router.get('/upc/main/:type?', require('./routes/universities/upc/main')); router.get('/upc/jsj/:type?', require('./routes/universities/upc/jsj')); // 华北水利水电大学 +router.get('/ncwu/file', require('./routes/universities/ncwu/file')); +router.get('/ncwu/news', require('./routes/universities/ncwu/news')); router.get('/ncwu/notice', require('./routes/universities/ncwu/notice')); +router.get('/ncwu/scholarship', require('./routes/universities/ncwu/scholarship')); // ifanr router.get('/ifanr/:channel?', require('./routes/ifanr/index')); diff --git a/lib/routes/universities/ncwu/file.js b/lib/routes/universities/ncwu/file.js new file mode 100644 index 0000000000..274850e9a4 --- /dev/null +++ b/lib/routes/universities/ncwu/file.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const date = require('@/utils/date'); +const cheerio = require('cheerio'); + +const baseUrl = 'https://www5.ncwu.edu.cn/channels/58.html'; + +module.exports = async (ctx) => { + const response = await got.get(baseUrl); + const $ = cheerio.load(response.data); + const list = $('div.xinxilist>ul>li'); + + ctx.state.data = { + title: '华水-学校文件', + link: baseUrl, + item: + list && + list + .map((index, item) => ({ + title: $(item) + .find('span') + .text(), + description: `文件下载请转跳详情页`, + pubDate: date( + $(item) + .find('i') + .text() + ), + link: $(item) + .find('a') + .attr('href'), + })) + .get(), + }; +}; diff --git a/lib/routes/universities/ncwu/news.js b/lib/routes/universities/ncwu/news.js new file mode 100644 index 0000000000..e9581a754c --- /dev/null +++ b/lib/routes/universities/ncwu/news.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const date = require('@/utils/date'); +const cheerio = require('cheerio'); + +const baseUrl = 'https://www5.ncwu.edu.cn/channels/4.html'; + +module.exports = async (ctx) => { + const response = await got.get(baseUrl); + const $ = cheerio.load(response.data); + const list = $('div.xinxilist>ul>li'); + + ctx.state.data = { + title: '华水-学校新闻', + link: baseUrl, + item: + list && + list + .map((index, item) => ({ + title: $(item) + .find('span') + .text(), + description: `详情请点击查看`, + pubDate: date( + $(item) + .find('i') + .text() + ), + link: $(item) + .find('a') + .attr('href'), + })) + .get(), + }; +}; diff --git a/lib/routes/universities/ncwu/notice.js b/lib/routes/universities/ncwu/notice.js index f1c745e2c2..d590bba74a 100644 --- a/lib/routes/universities/ncwu/notice.js +++ b/lib/routes/universities/ncwu/notice.js @@ -20,21 +20,23 @@ module.exports = async (ctx) => { .find('span') .text(), description: - `发自「` + + `来自「` + $(item) .find('a.dw') .text() + - `」`, + `」于 ` + + $(item) + .find('i') + .text(), pubDate: date( $(item) .find('i') .text() ), - link: - baseUrl + - $(item) - .find('a[target=_blank]') - .attr('href'), + link: $(item) + .find('a.dw') + .next() + .attr('href'), })) .get(), }; diff --git a/lib/routes/universities/ncwu/scholarship.js b/lib/routes/universities/ncwu/scholarship.js new file mode 100644 index 0000000000..fd3a5e172e --- /dev/null +++ b/lib/routes/universities/ncwu/scholarship.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const date = require('@/utils/date'); +const cheerio = require('cheerio'); + +const baseUrl = 'https://www5.ncwu.edu.cn/channels/2766.html'; + +module.exports = async (ctx) => { + const response = await got.get(baseUrl); + const $ = cheerio.load(response.data); + const list = $('div.xinxilist>ul>li'); + + ctx.state.data = { + title: '华水-学术动态', + link: baseUrl, + item: + list && + list + .map((index, item) => ({ + title: $(item) + .find('span') + .text(), + description: `详情请点击查看`, + pubDate: date( + $(item) + .find('i') + .text() + ), + link: $(item) + .find('a') + .attr('href'), + })) + .get(), + }; +};