feat(router): 添加武汉纺织大学就业信息 (#12662)
* feat(router): 添加武汉纺织大学就业信息 * 补交wtu-job radar.js * Update docs/university.md * feat(router): 添加武汉纺织大学就业信息 * feat(router): 添加武汉纺织大学就业信息 * fix(router): wtu-建议修改和代码优化 * feat(router): wtu-修改建议 * Update lib/v2/wtu/radar.js * refactor: migrate to v2 ---------
This commit is contained in:
+11
-1
@@ -2974,7 +2974,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
### 信息门户公告
|
||||
|
||||
<Route author="Loyio" example="/wtu/2" path="/wtu/:type" :paramsDesc="['公告类型,详见表格']">
|
||||
<Route author="loyio" example="/wtu/2" path="/wtu/:type" :paramsDesc="['公告类型,详见表格']">
|
||||
|
||||
| 公告类型 | 通知公告 | 教务信息 | 科研动态 |
|
||||
| -------- | -------- | -------- | -------- |
|
||||
@@ -2982,6 +2982,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
</Route>
|
||||
|
||||
### 就业信息
|
||||
|
||||
<Route author="ticks-tan" example="/wtu/job/xxtz" path="/wtu/job/:type" :paramsDesc="['信息类型']">
|
||||
|
||||
| 信息类型 | 消息通知 | 通知公告 | 新闻快递 |
|
||||
| -------- | -------- | -------- | -------- |
|
||||
| 参数 | xxtz | tzgg | xwkd |
|
||||
|
||||
</Route>
|
||||
|
||||
## 西安财经大学
|
||||
|
||||
### 教务处
|
||||
|
||||
+1
-1
@@ -3719,7 +3719,7 @@ router.get('/thrillist/:tag?', lazyloadRouteHandler('./routes/thrillist/index'))
|
||||
router.get('/dxy/vaccine/:province?/:city?/:location?', lazyloadRouteHandler('./routes/dxy/vaccine'));
|
||||
|
||||
// Wtu
|
||||
router.get('/wtu/:type', lazyloadRouteHandler('./routes/universities/wtu'));
|
||||
// router.get('/wtu/:type', lazyloadRouteHandler('./routes/universities/wtu'));
|
||||
|
||||
// 中国庭审公开网
|
||||
router.get('/tingshen', lazyloadRouteHandler('./routes/tingshen/tingshen'));
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
const apiUrl = 'http://ehall.wtu.edu.cn/wtu/api/queryBulletinListByConditional.do?pageNum=1&pageSize=8&columnId=';
|
||||
const listUrl = 'http://ehall.wtu.edu.cn/new/list.html?type=';
|
||||
const psgUrl = 'http://ehall.wtu.edu.cn/new/detail-word.html?';
|
||||
const map = new Map([
|
||||
[1, { title: '通知公告', type: '2', id: '1994a3b58bef4ee887e1efc19881decd' }],
|
||||
[2, { title: '教务信息', type: '5', id: '36d47fcd3e774f289adfef1d93138a9d' }],
|
||||
[3, { title: '科研动态', type: '3', id: '48e8abfb983b4e4486b69feacad1dc1b' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const typein = Number.parseInt(ctx.params.type);
|
||||
const title = map.get(typein).title;
|
||||
const columnId = map.get(typein).id;
|
||||
const type = map.get(typein).type;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: `${apiUrl}${columnId}`,
|
||||
});
|
||||
const res_json = res.data.bulletinList;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title} - 武汉纺织大学信息门户`,
|
||||
link: `${listUrl}${type}`,
|
||||
description: `${title} - 武汉纺织大学信息门户`,
|
||||
item: res_json.map((item) => ({
|
||||
title: item.TITLE,
|
||||
description: item.TITLE,
|
||||
pubDate: new Date(item.CREATE_TIME).toUTCString(),
|
||||
link: `${psgUrl}type=${type}?bulletinId=${item.WID}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const apiUrl = 'https://ehall.wtu.edu.cn/wtu/api/queryBulletinListByConditional.do?pageNum=1&pageSize=20&columnId=';
|
||||
const listUrl = 'https://ehall.wtu.edu.cn/new/list.html?type=';
|
||||
const psgUrl = 'https://ehall.wtu.edu.cn/new/detail-word.html?';
|
||||
const map = new Map([
|
||||
[1, { title: '通知公告', type: '2', id: '1994a3b58bef4ee887e1efc19881decd' }],
|
||||
[2, { title: '教务信息', type: '6', id: '36d47fcd3e774f289adfef1d93138a9d' }],
|
||||
[3, { title: '科研动态', type: '7', id: '48e8abfb983b4e4486b69feacad1dc1b' }],
|
||||
]);
|
||||
|
||||
const typeInt = parseInt(ctx.params.type);
|
||||
const value = map.get(typeInt);
|
||||
const title = value.title;
|
||||
const columnId = value.id;
|
||||
const type = value.type;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: `${apiUrl}${columnId}`,
|
||||
});
|
||||
const resJson = res.data.bulletinList;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title} - 武汉纺织大学信息门户`,
|
||||
link: `${listUrl}${type}`,
|
||||
description: `${title} - 武汉纺织大学信息门户`,
|
||||
item: resJson.map((item) => ({
|
||||
title: item.TITLE,
|
||||
pubDate: timezone(parseDate(item.CREATE_TIME), 8),
|
||||
link: item.GOTO_URL ?? `${psgUrl}type=${type}?bulletinId=${item.WID}`,
|
||||
author: item.PUBLISH_USER_DEPT_NAME,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const zlib = require('zlib');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const baseUrl = 'https://wtu.91wllm.com/';
|
||||
|
||||
const typeMap = new Map([
|
||||
['xxtz', { title: '信息通知', url: `${baseUrl}news/index/tag/xxtz` }],
|
||||
['tzgg', { title: '通知公告', url: `${baseUrl}news/index/tag/tzgg` }],
|
||||
['xwkd', { title: '新闻快递', url: `${baseUrl}news/index/tag/xwkd` }],
|
||||
]);
|
||||
|
||||
/**
|
||||
* 解压缩数据
|
||||
* @param {String} str
|
||||
* @returns {String}
|
||||
*/
|
||||
function decodeData(str) {
|
||||
// 匹配正则
|
||||
const regex = /Base64.decode\(unzip\("(.+?)"\)\.substr\((\d+)\)\)\.substr\((\d+)\)/;
|
||||
const match = str.match(regex);
|
||||
if (!match) {
|
||||
return '';
|
||||
}
|
||||
// 获取数据
|
||||
const compressedContent = match[1];
|
||||
const substr1Num = Number.parseInt(match[2]);
|
||||
const substr2Num = Number.parseInt(match[3]);
|
||||
// 解压缩
|
||||
const unzipContent = zlib.inflateSync(Buffer.from(compressedContent, 'base64')).toString('utf8');
|
||||
const content = Buffer.from(unzipContent.substring(substr1Num), 'base64');
|
||||
return content.toString('utf8').substring(substr2Num);
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// 获取参数 type
|
||||
const type = ctx.params.type;
|
||||
const mapItem = typeMap.get(type);
|
||||
const msgTitle = `${mapItem.title} - 武汉纺织大学就业信息`;
|
||||
const link = mapItem.url;
|
||||
|
||||
// 请求网页
|
||||
const resp = await got.get(link);
|
||||
// 解压缩列表数据
|
||||
const listStr = decodeData(resp.data);
|
||||
// 解析列表数据
|
||||
const $ = cheerio.load(listStr);
|
||||
const list = $('.newsList')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const $date = item.find("li[class='span2 y']").text();
|
||||
const $linkLi = item.find('li>a');
|
||||
const $url = new URL($linkLi.attr('href'), baseUrl).href;
|
||||
return {
|
||||
title: $linkLi.text(),
|
||||
pubDate: parseDate($date, 'YYYY-MM-DD'),
|
||||
link: $url,
|
||||
};
|
||||
});
|
||||
// 获取全文信息
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: response } = await got.get(item.link);
|
||||
const content = decodeData(response);
|
||||
item.description = content;
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: msgTitle,
|
||||
link,
|
||||
description: msgTitle,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/:type': ['loyio'],
|
||||
'/job/:type': ['ticks-tan'],
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
'91wllm.com': {
|
||||
_name: '湖北高校就业网络联盟',
|
||||
wtu: [
|
||||
{
|
||||
title: '武汉纺织大学就业信息',
|
||||
docs: 'https://docs.rsshub.app/university.html#wu-han-fang-zhi-da-xue',
|
||||
source: '/news/index/tag/:type',
|
||||
target: '/wtu/job/:type',
|
||||
},
|
||||
],
|
||||
},
|
||||
'wtu.edu.cn': {
|
||||
_name: '武汉纺织大学',
|
||||
wtu: [
|
||||
{
|
||||
title: '信息门户公告',
|
||||
docs: 'https://docs.rsshub.app/university.html#wu-han-fang-zhi-da-xue',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/:type', require('./index'));
|
||||
router.get('/job/:type', require('./job'));
|
||||
};
|
||||
Reference in New Issue
Block a user