Skip to content

Commit

Permalink
feat(route): 中国海洋大学信息科学与工程学部团学工作 (#13699)
Browse files Browse the repository at this point in the history
* feat(route): 中国海洋大学信息科学与工程学部团学工作

* Update lib/v2/ouc/it-tx.js

* Update lib/v2/ouc/it-tx.js

---------
  • Loading branch information
3401797899 authored Nov 6, 2023
1 parent cbf693e commit 68e33dc
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
44 changes: 44 additions & 0 deletions lib/v2/ouc/it-tx.js
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions lib/v2/ouc/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
'/it/postgraduate': ['shengmaosu'],
'/it/tx/:id?': ['3401797899'],
'/it/:type?': ['GeoffreyChen777', '3401797899'],
'/jwc': ['3401797899'],
'/jwgl': ['3401797899'],
Expand Down
6 changes: 6 additions & 0 deletions lib/v2/ouc/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
1 change: 1 addition & 0 deletions lib/v2/ouc/router.js
Original file line number Diff line number Diff line change
@@ -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'));
Expand Down
10 changes: 10 additions & 0 deletions website/docs/routes/university.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down

0 comments on commit 68e33dc

Please sign in to comment.