feat(route): 中国海洋大学信息科学与工程学部团学工作 (#13699)
* feat(route): 中国海洋大学信息科学与工程学部团学工作 * Update lib/v2/ouc/it-tx.js * Update lib/v2/ouc/it-tx.js ---------
This commit is contained in:
parent
cbf693e471
commit
68e33dcec7
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = {
|
||||
'/it/postgraduate': ['shengmaosu'],
|
||||
'/it/tx/:id?': ['3401797899'],
|
||||
'/it/:type?': ['GeoffreyChen777', '3401797899'],
|
||||
'/jwc': ['3401797899'],
|
||||
'/jwgl': ['3401797899'],
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -3861,6 +3861,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
</Route>
|
||||
|
||||
### 信息科学与工程学院团学工作 {#zhong-guo-hai-yang-da-xue-xin-xi-ke-xue-yu-gong-cheng-xue-yuan-tuan-xue-gong-zuo}
|
||||
|
||||
<Route author="3401797899" example="/ouc/it/tx/xwdt" path="/ouc/it/tx/:id?" paramsDesc={['默认为 `xwdt`,id过多,这里只举几个例']} radar="1">
|
||||
|
||||
| 新闻动态 | 学院活动 | 奖助工作获奖情况 |
|
||||
| -------- | -------- | ---------------- |
|
||||
| xwdt | tzgg | 21758 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 研究生院 {#zhong-guo-hai-yang-da-xue-yan-jiu-sheng-yuan}
|
||||
|
||||
<Route author="shengmaosu" example="/ouc/yjs" path="/ouc/yjs" radar="1"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue