diff --git a/lib/v2/ouc/it-tx.js b/lib/v2/ouc/it-tx.js new file mode 100644 index 00000000000000..2bf834aadd8c18 --- /dev/null +++ b/lib/v2/ouc/it-tx.js @@ -0,0 +1,44 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const host = 'https://it.ouc.edu.cn'; + const id = ctx.params.id || 'xwdt'; + const link = `${host}/tx/${id}/list.htm`; + const response = await got(link); + const $ = cheerio.load(response.data); + const typeTitle = $("span.Column_Anchor").text(); + const title = $("li.col_title h2").text(); + + const list = $('ul.wp_article_list li') + .toArray() + .map((e) => { + e = $(e); + const a = e.find('a'); + return { + title: a.attr('title'), + link: new URL(a.attr('href'), host).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(item.link); + const $ = cheerio.load(response.data); + item.author = '中国海洋大学信息科学与工程学院'; + item.description = $('.wp_articlecontent').html(); + return item; + }) + ) + ); + + ctx.state.data = { + title: `信息科学与工程学院团学工作 - ${typeTitle}${title === typeTitle ? "" : title}`, + description: '中国海洋大学信息科学与工程学院团学工作', + link, + item: out, + }; +}; diff --git a/lib/v2/ouc/maintainer.js b/lib/v2/ouc/maintainer.js index 0dbefd0dd4d38e..037ce4915cacf6 100644 --- a/lib/v2/ouc/maintainer.js +++ b/lib/v2/ouc/maintainer.js @@ -1,5 +1,6 @@ module.exports = { '/it/postgraduate': ['shengmaosu'], + '/it/tx/:id?': ['3401797899'], '/it/:type?': ['GeoffreyChen777', '3401797899'], '/jwc': ['3401797899'], '/jwgl': ['3401797899'], diff --git a/lib/v2/ouc/radar.js b/lib/v2/ouc/radar.js index f25355ae51b8d0..314557bed7cf59 100644 --- a/lib/v2/ouc/radar.js +++ b/lib/v2/ouc/radar.js @@ -14,6 +14,12 @@ module.exports = { source: ['/_s381/16619/list.psp', '/16619/list.htm', '/'], target: '/ouc/it/postgraduate', }, + { + title: '信息科学与工程学部团学工作', + docs: 'https://docs.rsshub.app/routes/university#zhong-guo-hai-yang-da-xue-xin-xi-ke-xue-yu-gong-cheng-xue-yuan-tuan-xue-gong-zuo', + source: ['/tx/:id/list.htm'], + target: '/ouc/it/tx/:id' + } ], jwc: [ { diff --git a/lib/v2/ouc/router.js b/lib/v2/ouc/router.js index 5ca3225918d4a6..bc31baf52fb62c 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/tx/:id?', require('./it-tx')); router.get('/it/:type?', require('./it')); router.get('/jwc', require('./jwc')); router.get('/jwgl', require('./jwgl')); diff --git a/website/docs/routes/university.mdx b/website/docs/routes/university.mdx index d83231bfaafa58..54ae864759bda6 100644 --- a/website/docs/routes/university.mdx +++ b/website/docs/routes/university.mdx @@ -3861,6 +3861,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +### 信息科学与工程学院团学工作 {#zhong-guo-hai-yang-da-xue-xin-xi-ke-xue-yu-gong-cheng-xue-yuan-tuan-xue-gong-zuo} + + + +| 新闻动态 | 学院活动 | 奖助工作获奖情况 | +| -------- | -------- | ---------------- | +| xwdt | tzgg | 21758 | + + + ### 研究生院 {#zhong-guo-hai-yang-da-xue-yan-jiu-sheng-yuan}