feat(route): update to v2 哈尔滨工程大学路由——研究生院、就业服务、工学新闻、水声工程 (#8459)

This commit is contained in:
Derek 2021-11-27 16:56:49 +08:00 committed by GitHub
parent 9b0877cffe
commit d3a9b3aeb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 532 additions and 505 deletions

View File

@ -626,27 +626,6 @@
{ title: '支持的快递公司列表', docs: 'https://docs.rsshub.app/other.html#kuai-di-100', source: '/', target: '/kuaidi100/company' },
],
},
'hrbeu.edu.cn': {
_name: '哈尔滨工程大学',
yjsy: [
{ title: '研究生院 - 通知公告', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/yjsy/announcement' },
{ title: '研究生院 - 新闻动态', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/yjsy/news' },
{ title: '研究生院 - 国家公派项目', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/yjsy/gjgp' },
{ title: '研究生院 - 国际合作与交流项目', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/yjsy/gjhz' },
],
job: [{ title: '就业服务平台 - 通知公告', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/job/tzgg' }],
uae: [
{ title: '水声学院 - 新闻动态', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/shuisheng/xwdt' },
{ title: '研究生院 - 通知公告', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/shuisheng/tzgg' },
],
},
'gongxue.cn': {
_name: '工学网',
'.': [
{ title: '要闻', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/gongxue/yw' },
{ title: '时讯', docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue', source: '/*', target: '/heu/gongxue/sx' },
],
},
'nsfc.gov.cn': {
_name: '国家自然科学基金委员会',
www: [

View File

@ -845,41 +845,53 @@ category 列表:
### 研究生院
<Route author="XYenon Derekmini" example="/heu/yjsy/announcement" path="/heu/yjsy/:type?" :paramsDesc="['栏目, 默认为 `announcement`']" radar="1" rssbud="1">
<Route author="Derekmini XYenon" example="/heu/yjsy/list/2981" path="/heu/yjsy/list/:id" :paramsDesc="['栏目编号,由 `URL` 中获取。']" radar="1" rssbud="1">
| 通知公告 | 新闻动态 | 国家公派项目 | 国际合作与交流项目 |
| ------------ | -------- | ------------ | ------------------ |
| announcement | news | gjgp | gjhz |
| 通知公告 | 新闻动态 | 学籍注册 | 奖助学金 | 其他 |
| :------: | :------: | :------: | :------: | :--: |
| 2981 | 2980 | 3009 | 3011 | ... |
</Route>
### 就业服务平台
<Route author="Derekmini" example="/heu/job/tzgg" path="/heu/job/:type?" :paramsDesc="['栏目, 默认为 `tzgg`']" radar="1" rssbud="1">
<Route author="Derekmini" example="/heu/job/list/tzgg" path="/heu/job/list/:id" :paramsDesc="['栏目,如下表']" radar="1" rssbud="1">
| 通知公告 |
| -------- |
| tzgg |
| 通知公告 | 热点新闻 |
| :------: | :------: |
| tzgg | rdxw |
</Route>
#### 大型招聘会
<Route author="Derekmini" example="/heu/job/bigemploy" path="/heu/job/bigemploy" radar="1" rssbud="1">
</Route>
#### 今日招聘会
<Route author="Derekmini" example="/heu/job/calendar" path="/heu/job/calendar" radar="1" rssbud="1">
</Route>
### 工学新闻
<Route author="Derekmini XYenon" example="/heu/news/yw" path="/heu/news/:type?" :paramsDesc="['栏目, 默认为 `yw`']" radar="1" rssbud="1">
<Route author="Derekmini XYenon" example="/heu/gx/list/xw/yw" path="/heu/gx/:type/:column/:id?" :paramsDesc="['页面类型,如 `新闻 - 要闻` 页面为 `list` 类型,`新闻 - 专题策划` 页面为 `card` 类型,通过直接观察页面来判断;','主栏,如 `新闻xw`,由 `URL` 中获取;','次栏,如 `要闻yw`,如果次栏存在,则为必选,由 `URL` 中获取。']" radar="1" rssbud="1">
| 要闻 | 时讯 |
| ---- | ---- |
| yw | sx |
| 新闻 | 新闻 - 要闻 | 新闻 - 专题策划 | 其他 |
| :------: | :---------: | :-------------: | :--: |
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
</Route>
### 水声工程学院通知
### 水声工程学院
<Route author="Derekmini" example="/heu/uae/xwdt" path="/heu/uae/:type?" :paramsDesc="['栏目, 默认为 `xwdt`']" radar="1" rssbud="1">
<Route author="Derekmini" example="/heu/uae/list/3751" path="/heu/uae/list/:id" :paramsDesc="['栏目编号,由 `URL` 中获取。']" radar="1" rssbud="1">
| 新闻动态 | 通知公告 |
| -------- | -------- |
| xwdt | tzgg |
| 新闻动态 | 通知公告 | 其他 |
| :------: | :------: | :--: |
| 3751 | 3752 | ... |
</Route>

View File

@ -710,15 +710,6 @@ router.get('/njupt/jwc/:type?', lazyloadRouteHandler('./routes/universities/njup
// 南昌航空大学
router.get('/nchu/jwc/:type?', lazyloadRouteHandler('./routes/universities/nchu/jwc'));
// 哈尔滨工程大学
router.get('/heu/ugs/news/:author?/:category?', lazyloadRouteHandler('./routes/universities/heu/ugs/news'));
router.get('/heu/yjsy/:type?', lazyloadRouteHandler('./routes/universities/heu/yjsy'));
router.get('/heu/gongxue/:type?', lazyloadRouteHandler('./routes/universities/heu/news'));
router.get('/heu/news/:type?', lazyloadRouteHandler('./routes/universities/heu/news'));
router.get('/heu/shuisheng/:type?', lazyloadRouteHandler('./routes/universities/heu/uae'));
router.get('/heu/uae/:type?', lazyloadRouteHandler('./routes/universities/heu/uae'));
router.get('/heu/job/:type?', lazyloadRouteHandler('./routes/universities/heu/job'));
// 重庆大学
router.get('/cqu/jwc/:path*', lazyloadRouteHandler('./routes/universities/cqu/jwc/announcement'));
router.get('/cqu/news/jzyg', lazyloadRouteHandler('./routes/universities/cqu/news/jzyg'));

View File

@ -1,80 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseUrl = 'http://job.hrbeu.edu.cn';
const typeMap = {
tzgg: {
name: '通知公告',
url: '/HrbeuJY/Web/Home/NewsList?43kuJdqqW6kyCmomBv0smMlyGfDy8QefMwSyc-jK8Ww=.shtml',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'tzgg';
const link = baseUrl + typeMap[type].url;
const response = await got({
method: 'get',
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const urlList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('a', e).attr('href'))
.get();
const titleList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('a', e).attr('title'))
.get();
const dateList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('.Article_PublishDate', e).text())
.get();
const out = await Promise.all(
urlList.map(async (itemUrl, index) => {
itemUrl = url.resolve(baseUrl, itemUrl);
if (itemUrl.indexOf('.shtml') !== -1) {
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const single = {
title: titleList[index],
link: itemUrl,
description: $('.article')
.html()
.replace(/src="\//g, `src="${url.resolve(baseUrl, '.')}`)
.replace(/href="\//g, `href="${url.resolve(baseUrl, '.')}`)
.trim(),
pubDate: dateList[index],
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
} else {
const single = {
title: titleList[index],
link: itemUrl,
description: '此链接为文件,请点击下载',
pubDate: dateList[index],
};
return Promise.resolve(single);
}
})
);
ctx.state.data = {
title: 'HEU就业服务平台-' + typeMap[type].name,
link,
item: out,
};
};

View File

@ -1,80 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseUrl = 'http://news.hrbeu.edu.cn';
const typeMap = {
yw: {
name: '要闻',
url: '/xw/yw.htm',
},
sx: {
name: '时讯',
url: '/xw/sx.htm',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'yw';
const link = baseUrl + typeMap[type].url;
const response = await got({
method: 'get',
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const urlList = $('.list-left-ul .txt-elise')
.slice(0, 10)
.map((i, e) => $('a', e).attr('href'))
.get();
const titleList = $('.list-left-ul .txt-elise')
.slice(0, 10)
.map((i, e) => $('a', e).attr('title'))
.get();
const dateList = $('.list-left-ul .txt-elise')
.slice(0, 10)
.map((i, e) => $('span', e).text())
.get();
const out = await Promise.all(
urlList.map(async (itemUrl, index) => {
itemUrl = url.resolve(baseUrl, itemUrl);
if (itemUrl.indexOf('.htm') !== -1) {
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const single = {
title: titleList[index],
link: itemUrl,
description: $('.v_news_content').html(),
pubDate: dateList[index],
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
} else {
const single = {
title: titleList[index],
link: itemUrl,
description: '此链接为跳转,点击标题查看',
pubDate: dateList[index],
};
return Promise.resolve(single);
}
})
);
ctx.state.data = {
title: '工学新闻-' + typeMap[type].name,
link,
item: out,
};
};

View File

@ -1,84 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseUrl = 'http://uae.hrbeu.edu.cn';
const typeMap = {
xwdt: {
name: '新闻动态',
url: '/3751/list.htm',
},
tzgg: {
name: '通知公告',
url: '/3752/list.htm',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'xwdt';
const link = baseUrl + typeMap[type].url;
const response = await got({
method: 'get',
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const urlList = $('.column-news-item')
.slice(0, 10)
.map((i, e) => $(e).attr('href'))
.get();
const titleList = $('.column-news-item')
.slice(0, 10)
.map((i, e) => $('.column-news-title', e).text())
.get();
const dateList = $('.column-news-item')
.slice(0, 10)
.map((i, e) => $('.column-news-date', e).text())
.get();
const out = await Promise.all(
urlList.map(async (itemUrl, index) => {
itemUrl = url.resolve(baseUrl, itemUrl);
if (itemUrl.indexOf('.htm') !== -1) {
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const single = {
title: titleList[index],
link: itemUrl,
description: $('.wp_articlecontent')
.html()
.replace(/src="\//g, `src="${url.resolve(baseUrl, '.')}`)
.replace(/href="\//g, `href="${url.resolve(baseUrl, '.')}`)
.trim(),
pubDate: dateList[index],
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
} else {
const single = {
title: titleList[index],
link: itemUrl,
description: '此链接为文件,请点击下载',
pubDate: dateList[index],
};
return Promise.resolve(single);
}
})
);
ctx.state.data = {
title: '水声工程学院-' + typeMap[type].name,
link,
item: out,
};
};

View File

@ -1,122 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseUrl = 'http://ugs.hrbeu.edu.cn';
const authorMap = {
gztz: {
all: '/2821',
},
jwc: {
all: '/jwc',
jxap: '/2847',
ksgl: '/2895',
xjgl: '/2902',
wytk: '/2897',
cjgl: '/2901',
},
sjjxyjlc: {
all: '/3206',
syjx: '/2847',
sysjs: '/sysjs',
xwsx: '/2909',
xwlw: '/2910',
kcsj: '/2911',
cxcy: '/2913',
xjjl: '/xjjl',
},
jypgc: {
all: '/3207',
jxyjyjxcg: '/2916',
zljk: '/2917',
},
zyjsc: {
all: '/3208',
zyyjcjs: '/2914',
cgsyb: '/2925',
jxmsyyxzjjs: '/2918',
ktjs: '/2919',
syjx: '/2920',
},
gjdxswhszjd: {
all: '/3209',
},
jsjxfzzx: {
all: '/3210',
jspx: '/2915',
},
zhbgs: {
all: '/3211',
lxkc: '/lxkc',
},
};
module.exports = async (ctx) => {
const author = ctx.params.author || 'gztz';
const category = ctx.params.category || 'all';
const link = baseUrl + authorMap[author][category] + '/list.htm';
const response = await got({
method: 'get',
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const urlList = $('.wp_article_list_table .border9')
.slice(0, 10)
.map((i, e) => $('a', e).attr('href'))
.get();
const titleList = $('.wp_article_list_table .border9')
.slice(0, 10)
.map((i, e) => $('a', e).text())
.get();
const dateList = $('.wp_article_list_table .border9')
.slice(0, 10)
.map((i, e) => $('.date', e).text())
.get();
const out = await Promise.all(
urlList.map(async (itemUrl, index) => {
itemUrl = url.resolve(baseUrl, itemUrl);
if (itemUrl.indexOf('.htm') !== -1) {
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const single = {
title: titleList[index],
link: itemUrl,
description: $('.wp_articlecontent')
.html()
.replace(/src="\//g, `src="${url.resolve(baseUrl, '.')}`)
.replace(/href="\//g, `href="${url.resolve(baseUrl, '.')}`)
.trim(),
pubDate: dateList[index],
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
} else {
const single = {
title: titleList[index],
link: itemUrl,
description: '此链接为文件,请点击下载',
pubDate: dateList[index],
};
return Promise.resolve(single);
}
})
);
ctx.state.data = {
title: '哈尔滨工程大学本科生院工作通知',
link,
item: out,
};
};

View File

@ -1,92 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseUrl = 'http://yjsy.hrbeu.edu.cn';
const typeMap = {
announcement: {
name: '通知公告',
url: '/2981/list.htm',
},
news: {
name: '新闻动态',
url: '/2980/list.htm',
},
gjgp: {
name: '国家公派项目',
url: '/3015/list.htm',
},
gjhz: {
name: '国际合作与交流项目',
url: '/3016/list.htm',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'announcement';
const link = baseUrl + typeMap[type].url;
const response = await got({
method: 'get',
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const urlList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('a', e).attr('href'))
.get();
const titleList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('a', e).text())
.get();
const dateList = $('.wp_article_list .list_item')
.slice(0, 10)
.map((i, e) => $('.Article_PublishDate', e).text())
.get();
const out = await Promise.all(
urlList.map(async (itemUrl, index) => {
itemUrl = url.resolve(baseUrl, itemUrl);
if (itemUrl.indexOf('.htm') !== -1) {
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const single = {
title: titleList[index],
link: itemUrl,
description: $('.wp_articlecontent')
.html()
.replace(/src="\//g, `src="${url.resolve(baseUrl, '.')}`)
.replace(/href="\//g, `href="${url.resolve(baseUrl, '.')}`)
.trim(),
pubDate: dateList[index],
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
} else {
const single = {
title: titleList[index],
link: itemUrl,
description: '此链接为文件,请点击下载',
pubDate: dateList[index],
};
return Promise.resolve(single);
}
})
);
ctx.state.data = {
title: '研究生院-' + typeMap[type].name,
link,
item: out,
};
};

47
lib/v2/heu/gx/card.js Normal file
View File

@ -0,0 +1,47 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://news.hrbeu.edu.cn';
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const column = ctx.params.column;
const id = ctx.params.id || '';
let toUrl;
if (id !== '') {
toUrl = rootUrl.concat('/', column, '/', id, '.htm');
} else {
toUrl = rootUrl.concat('/', column, '.htm');
}
const response = await got({
method: 'get',
url: toUrl,
headers: {
Referer: rootUrl,
},
});
const $ = cheerio.load(response.data);
const bigTitle = $('div.list-left-tt')
.text()
.replace(/[ ]|[\r\n]/g, '');
const card = $('li.clearfix')
.map((_, item) => ({
title: $(item).find('div.list-right-tt').text(),
pubDate: $(item).find('span').text() + ' ' + hour + ':' + minute,
link: $(item).find('a').attr('href'),
description: $(item).find('div.list-right-p').text(),
}))
.get();
ctx.state.data = {
title: '工学-' + bigTitle,
link: toUrl,
item: card,
};
};

73
lib/v2/heu/gx/list.js Normal file
View File

@ -0,0 +1,73 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://news.hrbeu.edu.cn';
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const column = ctx.params.column;
const id = ctx.params.id || '';
let toUrl;
if (id !== '') {
toUrl = rootUrl.concat('/', column, '/', id, '.htm');
} else {
toUrl = rootUrl.concat('/', column, '.htm');
}
const response = await got({
method: 'get',
url: toUrl,
headers: {
Referer: rootUrl,
},
});
const $ = cheerio.load(response.data);
const bigTitle = $('div.list-left-tt')
.text()
.replace(/[ ]|[\r\n]/g, '');
const list = $('li.txt-elise')
.map((_, item) => {
let link = $(item).find('a').attr('href');
if (link.indexOf('info') !== -1 && id !== '') {
link = rootUrl.concat(link.substring(2));
}
if (link.indexOf('info') !== -1 && id === '') {
link = rootUrl.concat('/', link);
}
return {
title: $(item).find('a').attr('title'),
pubDate: $(item).find('span').text() + ' ' + hour + ':' + minute,
link,
};
})
.get();
await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
if (item.link.indexOf('info') !== -1) {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('div.v_news_content').html();
} else {
item.description = item.title + '<br><br>' + '本文需跳转,请点击标题后阅读';
}
return item;
})
)
);
ctx.state.data = {
title: '工学-' + bigTitle,
link: toUrl,
item: list,
};
};

View File

@ -0,0 +1,42 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const response = await got({
method: 'get',
url: 'http://job.hrbeu.edu.cn/HrbeuJY/web',
});
const $ = cheerio.load(response.data);
const list = $('div.articlecontent')
.map((_, item) => {
const link = $(item).find('a.bigTitle').attr('href');
return {
title: $(item).find('a.bigTitle').text(),
pubDate:
$(item)
.text()
.replace(/[ ]|[\r\n]/g, '')
.substr(-10) +
' ' +
hour +
':' +
minute,
description: $(item).find('a.bigTitle').text() + '<br><br>' + '点击标题,登录查看招聘详情',
link,
};
})
.get();
ctx.state.data = {
title: '大型招聘会',
link: 'http://job.hrbeu.edu.cn/HrbeuJY/web',
item: list,
allowEmpty: true,
};
};

View File

@ -0,0 +1,54 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://job.hrbeu.edu.cn';
module.exports = async (ctx) => {
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
let strmMonth;
month < 10 ? (strmMonth = '0' + month) : (strmMonth = month);
const day = date.getDate();
const response = await got({
method: 'post',
url: 'http://job.hrbeu.edu.cn/HrbeuJY/Web/Employ/QueryCalendar',
json: {
yearMonth: year + '-' + strmMonth,
},
}).json();
let link = '';
for (let i = 0, l = response.length; i < l; i++) {
// if (response[i].day === Number('10')) {
if (response[i].day === Number(day)) {
link = response[i].Items[0].link;
}
}
const todayResponse = await got({
method: 'get',
url: rootUrl.concat(link),
});
const $ = cheerio.load(todayResponse.data);
const list = $('li.clearfix')
.map((_, item) => {
const link = $(item).find('span.news_tit.news_tit_s').find('a').attr('href');
return {
title: $(item).find('span.news_tit.news_tit_s').find('a').attr('title'),
description: $(item).find('span.news_tit.news_tit_s').find('a').attr('title') + '<br><br>' + '点击标题,登录查看招聘详情',
link,
};
})
.get();
ctx.state.data = {
title: '今日招聘会',
link: 'http://job.hrbeu.edu.cn/HrbeuJY/web',
item: list,
allowEmpty: true,
};
};

70
lib/v2/heu/job/list.js Normal file
View File

@ -0,0 +1,70 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://job.hrbeu.edu.cn';
const idMap = {
tzgg: {
name: '通知公告',
url: 'http://job.hrbeu.edu.cn/HrbeuJY/Web/Home/NewsList?43kuJdqqW6kyCmomBv0smMlyGfDy8QefMwSyc-jK8Ww=.shtml',
},
rdxw: {
name: '热点新闻',
url: 'http://job.hrbeu.edu.cn/HrbeuJY/Web/Home/NewsList?43kuJdqqW6kyCmomBv0smLeM5XMyxaJMXP0thrbMBWI=.shtml',
},
};
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const id = ctx.params.id;
const response = await got({
method: 'get',
url: idMap[id].url,
headers: {
Referer: rootUrl,
},
});
const $ = cheerio.load(response.data);
const list = $('li.list_item.i1')
.map((_, item) => {
let link = $(item).find('a').attr('href');
if (link.indexOf('.shtml') !== -1) {
link = rootUrl.concat(link);
}
return {
title: $(item).find('a').attr('title'),
pubDate: $(item).find('.Article_PublishDate').text() + ' ' + hour + ':' + minute,
link,
};
})
.get();
await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
if (item.link.indexOf('.shtml') !== -1) {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.article').html();
} else {
item.description = item.title + '<br><br>' + '本文需跳转,请点击标题后阅读';
}
return item;
})
)
);
ctx.state.data = {
title: '就业服务平台-' + idMap[id].name,
link: idMap[id].url,
item: list,
};
};

8
lib/v2/heu/maintainer.js Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
'/yjsy/list/:id': ['Derekmini'],
'/job/bigemploy': ['Derekmini'],
'/job/calendar': ['Derekmini'],
'/job/list/:id': ['Derekmini'],
'/gx/:type/:colume/:id?': ['Derekmini'],
'/uae/list/:id': ['Derekmini'],
};

73
lib/v2/heu/radar.js Normal file
View File

@ -0,0 +1,73 @@
module.exports = {
'hrbeu.edu.cn': {
_name: '哈尔滨工程大学',
yjsy: [
{
title: '研究生院',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:id/list.htm',
target: '/heu/yjsy/list/:id',
},
],
job: [
{
title: '大型招聘会',
docs: 'https://docs.rsshub.app/journal.html#ha-er-bin-gong-cheng-da-xue',
source: '/*',
target: '/heu/job/bigemploy',
},
{
title: '今日招聘会',
docs: 'https://docs.rsshub.app/journal.html#ha-er-bin-gong-cheng-da-xue',
source: '/*',
target: '/heu/job/calendar',
},
{
title: '就业服务平台-通知公告',
docs: 'https://docs.rsshub.app/journal.html#ha-er-bin-gong-cheng-da-xue',
source: '/*',
target: '/heu/job/list/tzgg',
},
{
title: '就业服务平台-热点新闻',
docs: 'https://docs.rsshub.app/journal.html#ha-er-bin-gong-cheng-da-xue',
source: '/*',
target: '/heu/job/list/rdxw',
},
],
news: [
{
title: '工学',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:column',
target: (params) => `/heu/gx/list/${params.column.replace('.htm', '')}`,
},
{
title: '工学',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:column/:id',
target: (params) => `/heu/gx/list/${params.column}/${params.id.replace('.htm', '')}`,
},
{
title: '工学-card',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:column',
target: (params) => `/heu/gx/card/${params.column.replace('.htm', '')}`,
},
{
title: '工学-card',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:column/:id',
target: (params) => `/heu/gx/card/${params.column}/${params.id.replace('.htm', '')}`,
},
],
uae: [
{
title: '水声学院',
docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-cheng-da-xue',
source: '/:id/list.htm',
target: '/heu/uae/list/:id',
},
],
},
};

9
lib/v2/heu/router.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = function (router) {
router.get('/yjsy/list/:id', require('./yjsy/list'));
router.get('/job/bigemploy', require('./job/bigemploy'));
router.get('/job/calendar', require('./job/calendar'));
router.get('/job/list/:id', require('./job/list'));
router.get('/gx/list/:column/:id?', require('./gx/list'));
router.get('/gx/card/:column/:id?', require('./gx/card'));
router.get('/uae/list/:id', require('./uae/list'));
};

62
lib/v2/heu/uae/list.js Normal file
View File

@ -0,0 +1,62 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://uae.hrbeu.edu.cn';
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const id = ctx.params.id;
const response = await got({
method: 'get',
url: rootUrl.concat('/', id, '/list.htm'),
headers: {
Referer: rootUrl,
},
});
const $ = cheerio.load(response.data);
const bigTitle = $('h2.column-title').text();
const list = $('a.column-news-item')
.map((_, item) => {
let link = $(item).attr('href');
if (link.indexOf('page.htm') !== -1) {
link = rootUrl.concat(link);
}
return {
title: $(item).find('span.column-news-title').text(),
pubDate: $(item).find('span.column-news-date').text() + ' ' + hour + ':' + minute,
link,
};
})
.get();
await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
if (item.link.indexOf('page.htm') !== -1) {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('div.wp_articlecontent').html();
item.title = content('h1.arti-title').text();
} else {
item.description = item.title + '<br><br>' + '本文需跳转,请点击标题后阅读';
}
return item;
})
)
);
ctx.state.data = {
title: '水声学院-' + bigTitle,
link: rootUrl.concat('/', id, '/list.htm'),
item: list,
};
};

65
lib/v2/heu/yjsy/list.js Normal file
View File

@ -0,0 +1,65 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'http://yjsy.hrbeu.edu.cn';
module.exports = async (ctx) => {
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const id = ctx.params.id;
const response = await got({
method: 'get',
url: rootUrl.concat('/', id, '/list.htm'),
headers: {
Referer: rootUrl,
},
});
const $ = cheerio.load(response.data);
const bigTitle = $('div [id=lanmuInnerMiddleBigClass_right]')
.find('div [portletmode=simpleColumnAttri]')
.text()
.replace(/[ ]|[\r\n\t]|[·]/g, '')
.trim();
const list = $('li.list_item')
.map((_, item) => {
let link = $(item).find('a').attr('href');
if (link.indexOf('page.htm') !== -1) {
link = rootUrl.concat(link);
}
return {
title: $(item).find('a').attr('title'),
pubDate: $(item).find('span.Article_PublishDate').text() + ' ' + hour + ':' + minute,
link,
};
})
.get();
await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
if (item.link.indexOf('page.htm') !== -1) {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('div.wp_articlecontent').html();
} else {
item.description = item.title + '<br><br>' + '本文需跳转,请点击标题后阅读';
}
return item;
})
)
);
ctx.state.data = {
title: '研究生院-' + bigTitle,
link: rootUrl.concat('/', id, '/list.htm'),
item: list,
};
};