feat(route): add /ustb/yzxc/tzgg (#12192)
* feat(route): add /ustb/yzxc/tzgg * udapte /ustb/yzxc/tzgg docs etc * fix: Incomplete string escaping or encoding * fix: Incomplete string escaping or encoding * fix: Incomplete string escaping or encoding * Update lib/v2/ustb/yzxc/tzgg.js ---------
This commit is contained in:
parent
c5d6b6b942
commit
4b0807f995
|
|
@ -234,6 +234,10 @@ pageClass: routes
|
|||
|
||||
</Route>
|
||||
|
||||
### 研究生招生信息网
|
||||
|
||||
<Route author="yanbot-team" example="/ustb/yzxc/tzgg" path="/ustb/yzxc/tzgg" />
|
||||
|
||||
### 北京科技大学天津学院
|
||||
|
||||
<Route author="henbf" example="/ustb/tj/news/all" path="/ustb/tj/news/:type" :paramsDesc="['默认为 `all`']">
|
||||
|
|
@ -605,7 +609,7 @@ pageClass: routes
|
|||
|
||||
| 博士研究生 | 硕士研究生 | 同等学力攻读硕士学位 | 港澳台地区招生 |
|
||||
| :--------: | :--------: | :------------------: | :------------: |
|
||||
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
|
||||
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -1195,7 +1199,7 @@ category 列表:
|
|||
|
||||
| 通知公告 | 新闻动态 | 学籍注册 | 奖助学金 | 其他 |
|
||||
| :------: | :------: | :------: | :------: | :--: |
|
||||
| 2981 | 2980 | 3009 | 3011 | ... |
|
||||
| 2981 | 2980 | 3009 | 3011 | ... |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -1227,7 +1231,7 @@ category 列表:
|
|||
|
||||
| 新闻 | 新闻 - 要闻 | 新闻 - 专题策划 | 其他 |
|
||||
| :------: | :---------: | :-------------: | :--: |
|
||||
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
|
||||
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -1237,7 +1241,7 @@ category 列表:
|
|||
|
||||
| 新闻动态 | 通知公告 | 其他 |
|
||||
| :------: | :------: | :--: |
|
||||
| 3751 | 3752 | ... |
|
||||
| 3751 | 3752 | ... |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -2278,7 +2282,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 通知公告 | 本科生教务 | 研究生教务 |
|
||||
| :------: | :--------: | :--------: |
|
||||
| tzgg | bksjw | yjsjw |
|
||||
| tzgg | bksjw | yjsjw |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -2668,7 +2672,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 聚焦天大 | 综合新闻 | 校内新闻 | 媒体报道 | 图说天大 |
|
||||
| :------: | :------: | :------: | :------: | :------: |
|
||||
| focus | general | internal | media | picture |
|
||||
| focus | general | internal | media | picture |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -2678,7 +2682,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 学部新闻 | 通知公告 | 北洋智算论坛 |
|
||||
| :------: | :----------: | :----------: |
|
||||
| news | notification | forum |
|
||||
| news | notification | forum |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -2698,7 +2702,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 校级公告 | 统考硕士 | 统考博士 | 在职学位 |
|
||||
| :------: | :------: | :------: | :------: |
|
||||
| notice | master | doctor | job |
|
||||
| notice | master | doctor | job |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -2746,7 +2750,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 温大新闻 | 媒体温大 | 学术温大 | 通知公告 | 招标信息 | 学术公告 |
|
||||
| :------: | :------: | :------: | :------: | :------: | :------: |
|
||||
| 0 | 1 | 2 | 3 | 4 | 5 |
|
||||
| 0 | 1 | 2 | 3 | 4 | 5 |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
@ -3551,7 +3555,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
| 招聘类型 | 博士后 | 课题项目聘用 | 管理支撑人才 | 教学科研人才 |
|
||||
| :------: | :----: | :----------: | :----------: | :----------: |
|
||||
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
|
||||
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,5 @@ module.exports = {
|
|||
'/yjsy/news/skl': ['DA1Y1'],
|
||||
'/yjsy/news/slam': ['DA1Y1'],
|
||||
'/yjsy/news/wenfa': ['DA1Y1'],
|
||||
'/yzxc/tzgg': ['yanbot-team'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,5 +9,13 @@ module.exports = {
|
|||
target: '/ustb/yjsy/news/:type',
|
||||
},
|
||||
],
|
||||
yzxc: [
|
||||
{
|
||||
title: '研究生招生信息网',
|
||||
docs: 'https://docs.rsshub.app/university.html#bei-jing-ke-ji-da-xue-yan-jiu-sheng-zhao-sheng-xin-xi-wang',
|
||||
source: '/',
|
||||
target: '/ustb/yzxc/tzgg',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/yjsy/news/:type', require('./yjsy/news'));
|
||||
router.get('/yzxc/tzgg', require('./yzxc/tzgg'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const host = 'https://yzxc.ustb.edu.cn';
|
||||
const url = `${host}/tzgg/index.htm`;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.page_content .ul-inline .box');
|
||||
const items = await Promise.all(
|
||||
list.map((i, item) => {
|
||||
const $item = $(item);
|
||||
const time = $item.find('.time').text();
|
||||
const titleDom = $item.find('.title a');
|
||||
const titleText = titleDom.text();
|
||||
const path = titleDom.last().attr('href');
|
||||
let itemUrl = '';
|
||||
if (path.startsWith('http')) {
|
||||
itemUrl = path;
|
||||
} else if (path.startsWith('..')) {
|
||||
itemUrl = path.replace(/\.\./g, host);
|
||||
} else {
|
||||
itemUrl = host + path;
|
||||
}
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
let description = titleText;
|
||||
const result = await got(itemUrl);
|
||||
const $ = cheerio.load(result.data);
|
||||
if ($('.article') && $('.article').html()) {
|
||||
description = $('.article').html().trim();
|
||||
}
|
||||
return {
|
||||
title: titleText,
|
||||
link: itemUrl,
|
||||
pubDate: parseDate(time),
|
||||
description,
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '北京科技大学研究生招生信息网 - 通知公告',
|
||||
link: url,
|
||||
description: '北京科技大学研究生招生信息网 - 通知公告',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue