feat(route): add 武汉大学弘毅学堂 (#13493)

* feat(route): add 武汉大学弘毅学堂

* docs: fix docs

---------
This commit is contained in:
Ethan Shen 2023-10-12 22:29:53 +08:00 committed by GitHub
parent 4d23701be1
commit 72fdc7d71d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 225 additions and 0 deletions

50
lib/v2/whu/hyxt.js Normal file
View File

@ -0,0 +1,50 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { domain, processMeta, getMeta, processItems } = require('./util');
module.exports = async (ctx) => {
const { category = 'tzgg' } = ctx.params;
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
const rootUrl = `https://hyxt.${domain}`;
const currentUrl = new URL(`${category}.htm`, rootUrl).href;
const { data: response } = await got(currentUrl);
const $ = cheerio.load(response);
let items = $('tr.content-title')
.slice(0, limit)
.toArray()
.map((item) => {
item = $(item);
const a = item.find('td a');
return {
title: a.text(),
link: new URL(a.prop('href'), rootUrl).href,
pubDate: parseDate(item.find('td').last().text()),
};
});
items = await processItems(items, ctx.cache.tryGet, rootUrl);
const meta = processMeta(response);
const siteName = getMeta(meta, 'SiteName');
const columnName = getMeta(meta, 'ColumnName');
ctx.state.data = {
item: items,
title: `${siteName} - ${columnName}`,
link: currentUrl,
description: getMeta(meta, 'ColumnKeywords'),
language: $('html').prop('lang'),
image: new URL($('div.top-logo img').prop('src'), rootUrl).href,
subtitle: columnName,
author: siteName,
allowEmpty: true,
};
};

View File

@ -1,5 +1,6 @@
module.exports = {
'/cs/:type': ['ttyfly'],
'/gs/:type?': ['Delreyaa'],
'/hyxt/:category?': ['nczitzk'],
'/news/:category?': ['SChen1024', 'nczitzk'],
};

View File

@ -15,6 +15,134 @@ module.exports = {
target: '/whu/gs',
},
],
hyxt: [
{
title: '弘毅学堂 - 新闻动态',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xwdt'],
target: '/whu/hyxt/xwdt',
},
{
title: '弘毅学堂 - 通知公告',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/tzgg'],
target: '/whu/hyxt/tzgg',
},
{
title: '弘毅学堂 - 学子风采',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xzfc'],
target: '/whu/hyxt/xzfc',
},
{
title: '弘毅学堂 - 学术论坛',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xslt'],
target: '/whu/hyxt/xslt',
},
{
title: '弘毅学堂 - 学堂简报',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xtjb'],
target: '/whu/hyxt/xtjb',
},
{
title: '弘毅学堂 - 人才培养',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy'],
target: '/whu/hyxt/rcpy',
},
{
title: '弘毅学堂 - 招生工作',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy/zsgz', '/rcpy'],
target: '/whu/hyxt/rcpy/zsgz',
},
{
title: '弘毅学堂 - 培养方案',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy/pyfa', '/rcpy'],
target: '/whu/hyxt/rcpy/pyfa',
},
{
title: '弘毅学堂 - 科研训练',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy/kyxl', '/rcpy'],
target: '/whu/hyxt/rcpy/kyxl',
},
{
title: '弘毅学堂 - 毕业去向',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy/byqx', '/rcpy'],
target: '/whu/hyxt/rcpy/byqx',
},
{
title: '弘毅学堂 - 学习资源',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/rcpy/xxzy', '/rcpy'],
target: '/whu/hyxt/rcpy/xxzy',
},
{
title: '弘毅学堂 - 学生工作',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz'],
target: '/whu/hyxt/xsgz',
},
{
title: '弘毅学堂 - 党团建设',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz/dtjs', '/xsgz'],
target: '/whu/hyxt/xsgz/dtjs',
},
{
title: '弘毅学堂 - 学术交流',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz/xsjl', '/xsgz'],
target: '/whu/hyxt/xsgz/xsjl',
},
{
title: '弘毅学堂 - 书院生活',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz/sysh', '/xsgz'],
target: '/whu/hyxt/xsgz/sysh',
},
{
title: '弘毅学堂 - 奖助体系',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz/jztx', '/xsgz'],
target: '/whu/hyxt/xsgz/jztx',
},
{
title: '弘毅学堂 - 事务服务',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xsgz/swfw', '/xsgz'],
target: '/whu/hyxt/xsgz/swfw',
},
{
title: '弘毅学堂 - 国际合作',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/gjhz'],
target: '/whu/hyxt/gjhz',
},
{
title: '弘毅学堂 - 国际交流',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/gjhz/gjjl', '/gjhz'],
target: '/whu/hyxt/gjhz/gjjl',
},
{
title: '弘毅学堂 - 交流分享',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/gjhz/jlfx', '/gjhz'],
target: '/whu/hyxt/gjhz/jlfx',
},
{
title: '弘毅学堂 - 校友风采',
docs: 'https://docs.rsshub.app/routes/university#wu-han-da-xue-hong-yi-xue-tang',
source: ['/xyfc'],
target: '/whu/hyxt/xyfc',
},
],
news: [
{
title: '新闻网 - 武大资讯',

View File

@ -1,5 +1,6 @@
module.exports = function (router) {
router.get('/cs/:type', require('./cs'));
router.get('/gs/:type?', require('./gs/index.js'));
router.get('/hyxt/:category*', require('./hyxt'));
router.get('/news/:category*', require('./news'));
};

View File

@ -3160,6 +3160,51 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
</Route>
### 弘毅学堂 {#wu-han-da-xue-hong-yi-xue-tang}
<Route author="nczitzk" example="/whu/hyxt" path="/whu/hyxt/:category?" paramsDesc={['分类,见下表,默认为 `xwdt` **新闻动态**']} radar="1" rssbud="1">
| 新闻动态 | 通知公告 | 学子风采 | 学术论坛 |
| -------- | -------- | -------- | -------- |
| xwdt | tzgg | xzfc | xslt |
<details>
<summary>更多分类</summary>
#### 学堂简报 {#wu-han-da-xue-hong-yi-xue-tang-xue-tang-jian-bao}
| 学堂简报 |
| -------- |
| xtjb |
#### 人才培养 {#wu-han-da-xue-hong-yi-xue-tang-ren-cai-pei-yang}
| 人才培养 | 招生工作 | 培养方案 | 科研训练 | 毕业去向 | 学习资源 |
| -------- | --------- | --------- | --------- | --------- | --------- |
| rcpy | rcpy/zsgz | rcpy/pyfa | rcpy/kyxl | rcpy/byqx | rcpy/xxzy |
#### 学生工作 {#wu-han-da-xue-hong-yi-xue-tang-xue-sheng-gong-zuo}
| 学生工作 | 党团建设 | 学术交流 | 书院生活 | 奖助体系 | 事务服务 |
| -------- | --------- | --------- | --------- | --------- | --------- |
| xsgz | xsgz/dtjs | xsgz/xsjl | xsgz/sysh | xsgz/jztx | xsgz/swfw |
#### 国际合作 {#wu-han-da-xue-hong-yi-xue-tang-guo-ji-he-zuo}
| 国际合作 | 国际交流 | 交流分享 |
| -------- | --------- | --------- |
| gjhz | gjhz/gjjl | gjhz/jlfx |
#### 校友风采 {#wu-han-da-xue-hong-yi-xue-tang-xiao-you-feng-cai}
| 校友风采 |
| -------- |
| xyfc |
</details>
</Route>
## 武汉纺织大学 {#wu-han-fang-zhi-da-xue}
### 信息门户公告 {#wu-han-fang-zhi-da-xue-xin-xi-men-hu-gong-gao}