feat(route): add 吉林工商学院教务处 (#7062)

This commit is contained in:
Ethan Shen 2021-03-03 05:44:19 +08:00 committed by GitHub
parent b87051f4ca
commit 945d7c03ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 0 deletions

View File

@ -913,6 +913,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
</Route>
### 教务处
<Route author="nczitzk" example="/jlbtc/jwc" path="/jlbtc/jwc/:id?" :paramDesc="['分类,见下表,默认为通知公告']">
| 教务新闻 | 通知公告 | 教务工作 | 教师发展工作 | 学籍考务工作 | 教学基本建设 |
| -------- | -------- | -------- | ------------ | ------------ | ------------ |
| 1888 | 1887 | 1947 | 1949 | 2011 | 1948 |
</Route>
## 暨南大学
## 暨南要闻

View File

@ -3947,6 +3947,7 @@ router.get('/obsidian/announcements', require('./routes/obsidian/announcements')
// 吉林工商学院
router.get('/jlbtc/kyc/:category?', require('./routes/universities/jlbtc/kyc'));
router.get('/jlbtc/jwc/:id?', require('./routes/universities/jlbtc/jwc'));
router.get('/jlbtc/:category?', require('./routes/universities/jlbtc/index'));
// DT 财经

View File

@ -0,0 +1,50 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id || '1887';
const rootUrl = 'http://jwc1.jlbtc.edu.cn';
const currentUrl = `${rootUrl}/wejlist.jsp?urltype=tree.TreeTempUrl&wbtreeid=${id}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.c2173')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}/${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('#vsb_content').html();
item.pubDate = new Date(content('.timestyle2172').text()).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};